-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathnode.ts
More file actions
23 lines (18 loc) Β· 562 Bytes
/
node.ts
File metadata and controls
23 lines (18 loc) Β· 562 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */
import { type Context, Application } from '@curveball/core'
import router from '@curveball/router'
const app = new Application()
console.log('http://localhost:1337 or http://127.0.0.1:1337')
console.log('Check: $ netstat -an')
app.use(
router('/', (ctx: Context) => {
ctx.status = 200
ctx.response.body = ['l', 'e', 'e', 't']
}),
router('/data', (ctx: Context) => {
ctx.status = 200
ctx.response.body = ['d', 'a', 't', 'a']
})
)
app.listen(1337)