flaska/test.mjs

27 lines
478 B
JavaScript
Raw Normal View History

2021-10-09 00:12:56 +00:00
import { Flaska } from './flaska.mjs'
2024-11-02 23:40:54 +00:00
const port = 51026
2021-10-09 00:12:56 +00:00
const flaska = new Flaska({}, )
2024-11-02 23:40:54 +00:00
flaska.devMode()
2021-10-09 00:12:56 +00:00
flaska.get('/', function(ctx) {
ctx.body = { status: true }
2021-10-09 00:12:56 +00:00
})
2024-11-02 23:40:54 +00:00
flaska.get('/:item/asdf/herp/:derp/bla', function(ctx) {
ctx.body = { item: ctx.params.item }
})
flaska.get('/a', function(ctx) {
ctx.body = { status: true }
})
flaska.get('/error', function(ctx) {
process.exit(1)
})
2021-10-09 00:12:56 +00:00
flaska.listen(port, function() {
console.log('listening on port', port)
})