Connecting to Database

All the third-party modules are at deno.land/x.

deno.json

{
	"imports":{
		"MySQL": "https://deno.land/x/mysql/mod.ts",
		"Postgres": "https://deno.land/x/postgresjs/mod.ts",
		"MongoDB": "https://deno.land/x/mongo@<LatestVersion>/mod.ts",
	}
}

MySQL

// import {Client} from "https://deno.land/x/mysql/mod.ts";

import {Client} from "MySQL";

const client = await new Client().connect({
	hostname: "127.0.0.1",
	username: "root",
	db: "users",
	password: "pass",
});

Postgres

MongoDB

Firebase

For more and different types of database connection - refer - official docs

[[DENO LAND/Basics/Environment Variables]]

Last updated