-
Notifications
You must be signed in to change notification settings - Fork 724
Open
Description
import { define } from "../../utils.ts";
import { MongoClient } from "npm:[email protected]";
export const handler = define.handlers({
async GET(ctx) {
const name = ctx.params.name;
const password = "1Ik1eA38GBcGqVDd"
const client = new MongoClient(`mongodb+srv://kavanmevada_db_user:${password}@cluster0.jua4ouv.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`);
await client.connect();
interface DinosaurSchema {
name: string;
skills: string[];
}
const db = client.db("animals");
const dinosaurs = db.collection<DinosaurSchema>("dinosaurs");
await dinosaurs.insertOne({
name: "deno",
skills: ["dancing", "hiding"],
});
const allDinosaurs = await dinosaurs.find({ name: "deno" }).toArray();
console.log(allDinosaurs);
client.close();
return new Response(
`Hello, ${name.charAt(0).toUpperCase() + name.slice(1)}!`,
);
},
});
deno build log:
Task build vite build
vite v7.1.7 building for production...
✓ 25 modules transformed.
_fresh/client/.vite/manifest.json 0.63 kB │ gzip: 0.24 kB
_fresh/client/assets/client-entry-PRjVyscb.css 1.83 kB │ gzip: 0.89 kB
_fresh/client/assets/fresh-island__Counter-lU_Fxzzr.js 0.82 kB │ gzip: 0.50 kB
_fresh/client/assets/preact.module-B5DG9wGp.js 10.91 kB │ gzip: 4.63 kB
_fresh/client/assets/client-entry-BnA5gZOx.js 24.55 kB │ gzip: 9.07 kB
✓ built in 1.38s
vite v7.1.7 building SSR bundle for production...
node_modules/.deno/[email protected]/node_modules/mongodb/lib/bson.js (1:245): "default" is not exported by "node_modules/.deno/[email protected]/node_modules/bson/lib/bson.node.mjs", imported by "node_modules/.deno/[email protected]/node_modules/mongodb/lib/bson.js".
node_modules/.deno/[email protected]/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js (1:474): "default" is not exported by "node_modules/.deno/[email protected]/node_modules/bson/lib/bson.node.mjs", imported by "node_modules/.deno/[email protected]/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js".
node_modules/.deno/[email protected]/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/service_workflow.js (1:319): "default" is not exported by "node_modules/.deno/[email protected]/node_modules/bson/lib/bson.node.mjs", imported by "node_modules/.deno/[email protected]/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/service_workflow.js".
node_modules/.deno/[email protected]/node_modules/mongodb/lib/mongo_logger.js (1:338): "default" is not exported by "node_modules/.deno/[email protected]/node_modules/bson/lib/bson.node.mjs", imported by "node_modules/.deno/[email protected]/node_modules/mongodb/lib/mongo_logger.js".
On visiting endpoint:
GET http://0.0.0.0:8000/api/asd
TypeError: (0 , sparse_bitfield_1.default) is not a function
at read (file:///home/kavan/Projects/fresh-project/_fresh/server/assets/_fresh-route___api_name_-CuFXV8Wx.mjs:10996:42)
at createMemoryCodePoints (file:///home/kavan/Projects/fresh-project/_fresh/server/assets/_fresh-route___api_name_-CuFXV8Wx.mjs:10998:34)
at file:///home/kavan/Projects/fresh-project/_fresh/server/assets/_fresh-route___api_name_-CuFXV8Wx.mjs:11100:68
Metadata
Metadata
Assignees
Labels
No labels