generated from Kotlin/multiplatform-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds js-app module that consumes the jsMain adapter from kmp module (k…
- Loading branch information
1 parent
6b088f9
commit 95a3300
Showing
29 changed files
with
895 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
`use strict` | ||
|
||
import {Adapter} from '../../../../build/js/packages/kresil-experiments-kmp/kotlin/kresil-experiments-kmp.mjs' | ||
import express from 'express' | ||
|
||
const app = express() | ||
const port = 8080 | ||
const adapterInstance = Adapter.getInstance(); | ||
|
||
app.get('/add', (req, res) => { | ||
adapterInstance.addBooks() | ||
res.send('Hardcoded books added successfully') | ||
}) | ||
|
||
app.get('/books', (req, res) => { | ||
const books = adapterInstance.getBooks() | ||
res.send(books) | ||
}) | ||
|
||
// Route to handle clearing all books via DELETE request | ||
app.get('/clear', (req, res) => { | ||
adapterInstance.clearBooks() | ||
res.send('All books cleared successfully'); | ||
}); | ||
|
||
app.get('/platform', (req, res) => { | ||
const platform = adapterInstance.getPlatform() | ||
res.send(platform) | ||
}) | ||
|
||
// will never succeed | ||
app.get('/ignore', (req, res) => { | ||
const result = adapterInstance.ignored() | ||
res.send(result) | ||
}) | ||
|
||
// Start the server | ||
app.listen(port, () => { | ||
console.log(`Server is listening at http://localhost:${port}`) | ||
}) |
Oops, something went wrong.