Hello World HTTP server

First, ensure that you have Node.js installed on your platform. We use https://nvm.sh In this example, we’ll create an HTTP server listening on port 1337, which sends Hello, World! to the browser. Note that instead of using port 1337, you can use any port of your choice which is currently not in use by any other service. Typical ports used by developers are 1337, 3000, 5000, 8080 The HTTP module is a Node.js core module (a module included in Node.js’s source that does not require installing additional resources). The HTTP module provides the functionality to create an HTTP server using the http.createServer() method. To create the application, create a file containing the following JavaScript code. ...

December 4, 2022 · 2 min

Restrict path access to prevent path traversal

Often we will refer to a file on disk or other resource using a path. For example, a path traversal attack is when an attacker supplies input that gets used with our path to access a file on the file system that we did not intend. The input usually attempts to break out of the application’s working directory and access a file elsewhere on the file system. You can mitigate this attack category by restricting the scope of file system access and reducing the attack surface by using a restricted file permission profile. ...

September 27, 2022 · 3 min

Privacy - it really matters

Do you know what data is collected and used from any websites you visit? Ctrl Tilde has decided that what we collect should be public. 🤯 We measure visitors to our website using Plausible Analytics, an open-source and privacy-friendly alternative that doesn’t come from the adtech world. Plausible records which pages you view, how you arrived at our site, and some basic information about your computer. All that information is anonymous – so we don’t know who you are, just that somebody visited our site. ...

August 12, 2022 · 1 min

JWKs and node-jose

After weeks of searching for documentation and examples on how to use node-Jose for: Create an endpoint to expose the public part of the keys Create an endpoint that returns a signed JWT with those keys Validate the token issued as a client Rotate the keys by an endpoint I found very little, so here’s how I did it. You are welcome to use https://github.com/ctrlTilde/node-api-skeleton as a skeleton, and all examples below will assume the same. ...

August 10, 2022 · 6 min

How to Delete a Key From an Object in JavaScript or Node.js

Deleting keys from an object may happen in a handful of situations. Like, in case a request contains a key-value pair that isn’t allowed to be part of the request and you still want to handle that request. You can then delete the keys not being allowed and proceed to process the request. This tutorial shows you how to remove one or many keys from a JavaScript object. Delete an Object Property in JavaScript ...

June 14, 2022 · 2 min

How To Setup Your Local Node.js Development Environment Using Docker

April 9, 2022 · 0 min

Git fork vs. clone: What's the difference?

Both Git fork and clone create copies of a repository, but they offer drastically different access levels, isolation and control over the target repo. The critical difference between Git clone and fork is how much control and independence you want over the codebase once you’ve copied it.

April 9, 2022 · 3 min

forking (software fork)

Forking is to take the source code from an open-source software program and develop an entirely new program.

April 9, 2022 · 1 min

The development series

The development series aims to bring you language-specific getting started guides to walk you through the process of setting up your development environment and start containerising language-specific applications using Docker. The learning modules contain best practices and guidelines that explain how to create a new Dockerfile for your preferred language, what to include in the Docker image, how to develop and run your Docker image, set up a CI/CD pipeline, and finally provides information on how to push the application you’ve developed to the cloud. ...

March 24, 2022 · 1 min

Nodejs

What will you learn in this module? The Node.js getting started guide teaches you how to create a containerized Node.js application using Docker. In this guide, you’ll learn how to: Create a simple Node.js application Create a new Dockerfile which contains instructions required to build a Node.js image Run the newly built image as a container Set up a local development environment to connect a database to the container Use Docker Compose to run the Node.js application Configure a CI/CD pipeline for your application using GitHub Actions. After completing the Node.js getting started modules, you should be able to containerize your own Node.js application based on the examples and instructions provided in this guide. ...

March 24, 2022 · 1 min