I tried Deno (https://deno.land/) in local pc and some of its examples and we have to run the server before executing the APIs in the local environment.
I need to host it in the server so that I can call that API when we request, but i don't know how to do it.
I have the experience in hosting PHP,.NET in production mode i haven't used Nodejs yet so i don't know that process.
Due to its single executable and easily accessible Docker Images, Deno is a breeze to package for production. Even when the docker images were not published, a simple Dockerfile based on debian:slim with installation script will run your code without a problem.
Node. JS is ideal for fast, lightweight, real-time web applications such as audio/video streaming, browser games, chats, collaboration tools social media, time trackers, and much more. For this reason, many companies decide to use Node. js in production.
Since Ryan Dahl first announced Deno, it has made significant progress. 1.0 was released in August 2020, and companies like Slack, Netlify, and GitHub have adopted Deno. In addition, The Deno Company has also released its own edge serverless function platform, Deno Deploy.
Deno is a simple, modern and secure runtime for JavaScript, TypeScript, and WebAssembly that uses V8 and is built in Rust. Provides web platform functionality and adopts web platform standards. Secure by default. No file, network, or environment access, unless explicitly enabled.
However, due to its infancy, Deno is not yet widely used or recommended for critical production applications. . Deno is open-source software available under the MIT license. Contributions are encouraged via the Deno Project and should follow the Deno contribution guidelines. Congratulations on your practical introduction to using Deno.
The run command runs any Deno code. And if you’re stuck, run deno --help, or deno -h, to get help using denocommands. Deno also provides a way to run programs from a local file, a URL, or by integrating with other applications in the stdin by using "-" (without quotes).
We request everyone using Deno to submit your applications so the community can grow even further and understand how Deno is maturing.
Deno runs JavaScript or TypeScript or WebAssembly applications on the underlying V8 engine, just like Node.js does. For application developers, there are several noticeable differences between Deno and Node.js. Unlike the modular binaries in Node.js, Deno is a single binary application.
You can use the cloud provider of your preference, AWS, DigitalOcean, Azure... and install deno
and then you can use pm2
using interpreter
flag to automatically restart if the server crashes and/or start the server on boot.
The easiest way is to create an ecosystem.config.js
module.exports = {
apps: [
{
name: "app",
script: "./deno.js",
interpreter: "deno",
interpreterArgs: "run --allow-net --allow-read",
},
],
};
And use interpreterArgs
to pass arguments that you need to pass to deno
.
Now all you need to do is:
pm2 start
Now your server will be available on whatever port you setup your server. You can use Nginx as a reverse proxy if you want too.
You can also use any process manager of your preference
You can just use:
pm2 start index.ts --interpreter="deno" --interpreter-args="run --allow-net"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With