DEV Community

Cover image for Nodemon Like Reloader πŸ”„ in Deno (Denon)
Haaris Iqubal for Recoding

Posted on β€’ Edited on β€’ Originally published at Medium

2 1

Nodemon Like Reloader πŸ”„ in Deno (Denon)

It might be frustrating to always close your Deno server and restart it again. As Deno doesn't provide "Hot Reload" out of the box but still there is a way to do it, so no more closing your server and restart it again or banging your head to a desk πŸ˜….

For the sake of this example we gonna make little Deno application into "app.ts" file

import { serve } from "https://deno.land/std@0.52.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
 req.respond({ body: "Hello World\n" });
}

After saving the code you need to install Denon. Denon is the deno replacement for nodemon providing a feature-packed and easy to use experience. You need to upgrade Deno v1.0.2 to install the Denon simple type the following command.

$ deno upgrade

Now you just need to write the following command into your Terminal or PowerShell and you ready to go.

$ deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts

Denon uses unstable features of the stdlib, as a result the flagβ€Š-β€Šunstable currently required for the installation. You can see various other options Denon has provided by simply writing "denon -h" or "denon- help". For running our app.ts file we need to write denon run then we have to pass the flag so that our app will only pass those options require by the user then we need to type the file name.

$ denon run -allow-env -allow-net app.ts

Now enjoy the feature of host reload on the fly whenever you change your file. Just try to change the body msg to "Deno is amazing" and you are done.

You can also follow our video tutorial also on youtube on Recoding .

Top comments (1)

Collapse
 
khophi profile image
KhoPhi β€’

Thanks for the article. Super simple to get running. I'm getting started with Deno and needed exactly something like this.

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay