0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 10:51:01 +00:00
hono/example/basic/index.js

20 lines
368 B
JavaScript
Raw Normal View History

2021-12-15 02:41:28 +00:00
const Hono = require('../../src/hono')
const app = Hono()
// Text
app.get('/', () => 'Hono!!')
// JSON
app.get('/api', () => { return { message: 'Hello! from /api' } })
// With original response header
app.get('/hello', () => {
return new Response('Hello! from /hello', {
status: 200,
headers: {
'X-Message': 'This is Hono'
}
})
})
app.fire()