"npm run dev " fails

Try to make a project using cloudflare with postgres as db.
import { Hono } from 'hono'
import { sign, verify } from 'hono/jwt'
import { getPrisma } from '../prismaFunction'

// Create the main Hono app
const app = new Hono()

app.get('/', (c) => {
// Now you can use it wherever you want
try {
return c.text("hello world")
} catch (error) {
console.log(error)
}
})
import { Hono } from 'hono'
import { sign, verify } from 'hono/jwt'
import { getPrisma } from '../prismaFunction'

// Create the main Hono app
const app = new Hono()

app.get('/', (c) => {
// Now you can use it wherever you want
try {
return c.text("hello world")
} catch (error) {
console.log(error)
}
})
this boiler plate code is showing "An error has occurred"
No description
1 Reply
Gab
Gab5d ago
you need to export the hono app at your index.ts/js file (or the taget main file at jsonc) your can simple add this snnipet at end of your code
export default app;
export default app;
if you pretend to use other functionalities such as queues, email or scheduled, you can extend to ->
export default {
fetch: app.fetch,
async queue(batch: MessageBatch<Error>, env: Environment) {....},
async
}
scheduled: yourSchedulerFunction,
export default {
fetch: app.fetch,
async queue(batch: MessageBatch<Error>, env: Environment) {....},
async
}
scheduled: yourSchedulerFunction,

Did you find this page helpful?