Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

RunKit + npm: hono

node v18.11.0
version: master
endpointsharetweet
const { Hono } = require('hono'); const { logger } = require('hono/logger'); const { cors } = require('hono/cors'); const app = new Hono(); app.use('*', logger()); app.use('*', cors({ origin: '*' })); app.get('/error', () => { throw new Error('Test error'); }); app.onError((err, ctx) => { return ctx.json({ error: true, status: 500, message: err.message, }); }); const main = async () => { const res = await app.request('http://localhost/error'); console.log([ ...res.headers.entries() ]); }; main();
Created from: https://npm.runkit.com/hono
Loading…

no comments

    sign in to comment