Skip to content

Commit

Permalink
setup quote params for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwiseman committed Jul 8, 2024
1 parent eb99cbc commit 4782501
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions apps/nitro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"private": true,
"scripts": {
"build": "nitro build",
"dev": "nitro dev --port 3001",
"dev": "bun with-env nitro dev --port 3001",
"prepare": "nitro prepare",
"preview": "node .output/server/index.mjs"
"preview": "node .output/server/index.mjs",
"with-env": "dotenv -e ../../.env --"

},
"devDependencies": {
"nitropack": "latest"
Expand Down
6 changes: 0 additions & 6 deletions apps/nitro/server/routes/index.ts

This file was deleted.

9 changes: 9 additions & 0 deletions apps/nitro/server/routes/quotes/[qId]/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { db, eq, quote } from "@quotes/db"

export default eventHandler(async (event) => {
if (typeof event.context.params?.qId !== "number") return "Please provide a quote id!"
console.log("Getting id:", event.context.params.qId)
const data = await db.query.quote.findFirst({ where: eq(quote.id, event.context.params.qId) })
console.log(data)
return "Start by editing <code>server/routes/index.ts</code>.";
});

0 comments on commit 4782501

Please sign in to comment.