mirror of
https://github.com/honojs/hono.git
synced 2024-12-01 10:51:01 +00:00
20 lines
368 B
JavaScript
20 lines
368 B
JavaScript
|
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()
|