🏯 Hono Backend
Create a web server with Node.js & Hono
Extra Resources
REST APIs in 100 Seconds: YouTube Video
Commands
Refer to the Hono documentation.
npm create hono@latest my-app
cd my-app
npm run dev
Prompt Template
Create a basic backend server with [SOME WEB FRAMEWORK].
Create a GET route and POST route on the root path "/" that returns a text response with a message. Adapt the Hono code below as a reference.
Code
src/index.ts
import { serve } from '@hono/node-server'
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
c.text('GET it')
})
app.post('/', (c) => {
c.text('POST it')
})
const port = 3000
console.log(`Server is running on port ${port}`)
serve({
fetch: app.fetch,
port
})