Deno is a JavaScript Runtime based on Chrome's V8 JavaScript Engine, which allows you to run JavaScript outside of the browser.
- Deno supports JavaScript and TypeScript
- Deno supports URL imports and modern JavaScript features (eg. Promises)
- Deno is "secure by default" and requires explicit execution permissions
- CON: Only JavaScript, modern JS features are missing, custom module system, no script permissions
- PRO: Established, highly active ecosystem, used by thousands of (big) companies, huge base of maintainers, production-proven
- CON: Pretty new, small ecosystem, not used in production by major companies yet, smaller base of maintainers, not really used in production yet
- PRO: TypeScript support, modern JS features, URL imports, script permissions
If you don't need all the Deno enhancements, use Node
Homepage and Instructions: https://deno.land
$ brew install deno
Check Install:
$ deno --version
$ deno
$ deno run <filename>
Re-fetch remote files with reload:
$ deno run --reload <filename>
Download extension: Deno from denoland
You must enable Deno on a project level, so add a .vscode/settings.json to your main project directory enabling it:
{
"deno.enable": true,
}
Give Deno permissions by adding flags.
For example, give Deno permission to write a file:
$ deno run --allow-write <filename>
For example, give Deno permission to write a specific file:
$ deno run --allow-write=<filename_to_write_to> <filename_to_run>
For example, give Deno permission to read a file:
$ deno run --allow-read <filename>
- stable and maintained by Core Team
- built-into Deno, no installation or imports required
- only a small set of low-level core functionalities
- Example: Deno.writeFile()
- https://doc.deno.land/builtin/stable
- unstable and maintained by Core Team
- needs to be imported into scripts to be used
- builds up on core, low-level functionalities to provide easier-to-use functionalities
- https://deno.land/std@0.77.0
- stability differs and maintained by community teams
- needs to be imported into scripts to be used
- builds up on core, low-level functionalities to provide easier-to-use functionalities
- https://deno.land/x
-
Create a Procfile with the following:
web: deno run --allow-net --allow-write --allow-read --allow-plugin --allow-env --unstable --no-check app.ts
-
On the Heroku Dashboard, create a new application
-
On the new application, go to the Settings page
-
Click the Add buildpack button
-
Enter the following URL in the input box:
https://github.com/chibat/heroku-buildpack-deno.git
-
Add your environment variables to under Settings -> Config Vars
-
Log in to heroku
$ heroku login
-
Initialize Heroku git with your app
$ heroku git:remote -a <your-app-name>
-
Commit your code
$ git add . $ git commit -am 'commit message' $ git push heroku master
-
Logs for server
$ heroku logs --tail