hono
コンテキスト
https://hono.dev/docs/api/context
リンクにアクセスしたときに返すやつ
code:index.ts
app.get('/', (c) => { // c is context
return c.body('Its home', 201, {
'X-Message': 'HOME',
'Content-Type': 'text/plain'
});
})
app.get('/api', (c) => {
return c.json({ message: 'Hello'});
})
app.get('/html', (c) => {
return c.html("<h1>call</h1>")
})
tsx
code:index.tsx
const helloWorld = <h1>
Hello world
</h1>
app.get('/html', (c) => {
return c.html(helloWorld);
})
https://zenn.dev/yusukebe/articles/0c7fed0949e6f7
#jsフレームワーク