How do I deploy my Deno application to heroku which uses a postgresql database?

263 views Asked by At

I have an application which I'd like to deploy to heroku. I have already created the application in heroku and added the deno buildpack. I have also set up the databse using psql and created the tables. Now the only problem is I don't know how to write or use the .env file so that the Deno application can access the correct database credentials.

1

There are 1 answers

0
Morani On

https://deno.land/x/[email protected]
this extension will help you.

If you want to use env with Deno:

import "https://deno.land/x/dotenv/load.ts";

console.log(Deno.env.get('GREETING'));

Another way:

// app.ts
import { config } from "https://deno.land/x/dotenv/mod.ts";

console.log(config());