Created
September 29, 2021 08:29
-
-
Save ashutoshpw/f38f4812a1c41010cb959e007fb3c51e to your computer and use it in GitHub Desktop.
deno-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MongoClient } from "https://deno.land/x/[email protected]/mod.ts"; | |
const URI = "mongodb://127.0.0.1:27017"; | |
addEventListener("fetch", async (event) => { | |
const client = new MongoClient(); | |
try { | |
await client.connect(URI); | |
console.log("Database successfully connected"); | |
} catch (err) { | |
console.log(err); | |
} | |
event.respondWith( | |
new Response("Hello world", { | |
status: 200, | |
headers: { "content-type": "text/plain" }, | |
}), | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment