Deno is a modern and secure runtime for JavaScript and TypeScript that uses V8 Javascript Engine and it's built in Rust, made by the Node.js creator, Ryan Dahl. Today we'll build a simple Deno App and make a container with it.
Recently, I was in Developer Communities Whatsapp's groups talking about new technologies, many of them were telling me about a new one created by the creator of Node.js…
Wait… what was its name again? Deno? What Deno is?
Deno is a modern and secure runtime for JavaScript and TypeScript that uses V8 Javascript Engine and it's built in Rust, made by the Node.js creator, Ryan Dahl. Today we'll build a simple Deno App and make a container with it.
What will you need to succeed?
Docker installed on your PC.
Deno Installed on your PC.
Git… maybe?
(PD: Could be a MacOs Machine too) :D
So…. Let's start!
Create a new folder and add a new file, the name will be "Main.ts".
Let's make a "Hello World" server for testing purposes; paste this code on your Main.ts:
plain text
import { serve } from "https://deno.land/std/http/server.ts"
const port:number = 42069;
const server = serve({ port: port});
const url:string = "http://localhost:" + port;
console.log('Server running on: ' + url );
for await(const req of server){
req.respond({ body: "Hi, guys from #DenoDominicana, this is a Hello World server example."});
}
Let's run this on your terminal window!
If we open "http://localhost:42069" on our browser, we can confirm that the server is up and running.
Now we know everything is running cool and smooth, let's create a new Docker Container with our server. :D
Create a new dockerfile.
Paste this:
plain text
FROM hayd/alpine-deno:1.2.2
EXPOSE 42069
WORKDIR /app
USER deno
COPY . .
RUN deno cache main.ts
CMD ["run", "--allow-net", "main.ts"]
This dockerfile ensures to use an image named "hayd/alpine-deno" to use Deno in our pc without even install it!
Let's build and run the dockerfile on the terminal window; write the following command and hit enter.
and when we go to "http://localhost:42069" in our browser, the server is running without problems.
With this approach, we can achieve a lot of advantages isolating your Deno backend and putting it run on whatever environment you want thanks to Docker.
NuGet Lens is a desktop tool I started building to visually inspect .NET solution dependencies, project references, and NuGet version conflicts without having to manually reconstruct everything from multiple .csproj files.
Pokemon? The Legend of Zelda? Final Fantasy? Looking for that weird walking (just up/down — left/right) style? don’t know how to implement it in your new video game project? well, I do and I’m gonna show you how to.