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 .

Redis image

62% faster than every other vector database

Tired of slow, inaccurate vector search?
Redis delivers top recall and low latency, outperforming leading vector databases in recent benchmarks. With built-in ANN and easy scaling, it’s a fast, reliable choice for real-time AI apps.

Get started

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.

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

Zero to Live in Seconds: Netlify for Builders

Join us live with Netlify as we explore how modern devs are building, deploying, and scaling full-stack apps at lightning speed. We’ll cover everything from instant deploys to edge functions and what makes Netlify the go-to platform for frontend-first workflows. Perfect for builders who want more shipping, less setup.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️