import { App } from '@tinyhttp/app'
import { logger } from '@tinyhttp/logger'
const app = new App()
app
.use(logger())
.get(
'/',
(_, res) =>
void res.format({
html: () => res.send('
Hello World
'),
text: () => res.send('Hello World')
})
)
.get('/page/:page/', (req, res) => {
res.status(200).send(`
Some cool page
URL
${req.url}
Params
${JSON.stringify(req.params, null, 2)}
`)
})
.listen(3000, () => console.log('Listening on http://localhost:3000'))