sample-api
Version:
A Hono.js library to generate random 16-digit codes
17 lines (12 loc) • 480 B
text/typescript
import { Hono } from 'hono';
import { generateRandomCode } from './utils';
const app = new Hono();
// Define the /generate route
app.get('/generate', (c) => {
const code = generateRandomCode();
return c.text(code);
});
// Export handler for serverless or other environments
export const handler = app.fetch;
// For local development, if needed (with an express-like environment):
// app.listen(3000); // This won't work with the latest Hono in some cases