ICYMI, Deno v1.0 has been released!
But what is Deno?
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that u...
For further actions, you may consider blocking this person and/or reporting abuse
Great post, thanks!
You dont have to expose db credentials, you can do it like this
just import --> import "deno.land/x/denv/mod.ts"; <-- to db.ts file
const dbName = Deno.env.get("DB_NAME") as string;
const dbHostUrl = Deno.env.get("DB_HOST_URL") as string;
Yup! Can do!
After the first code snippet, I get an error:
Any thoughts on whats going wrong?
Looks like your denv module is missing. Maybe you weren't connected to the internet when you ran the program and Deno couldn't load the module. You need an active net connection to get the denv and abc modules.
Thanks Saswata. I removed the cache dir (~/.cache/deno) and executed the deno run command again. Got the same error alas. This time I was on a network cable (previously on wifi) and deno didn't report any errors during all download. I'm giving up I'm afraid. The message is not very clear and Google is not my friend in this instance.
you are missing .env file
That was the solution! It seems we need an empty .env in the project dir. Thanks Nikola!
NP. I have made same mistake :D
Which deno version you used ? I use deno@1.0.0 to run your code will cause some problem.
For this article I have used:
deno 1.0.0
v8 8.4.300
typescript 3.9.2
If you have any further problems you can refer to the GitHub repo linked in the article!
Thanks. It works now!