Articles
Publish a module to NPM
This article is based on <a href="https://www.freecodecamp.org/news/how-to-make-a-beautiful-tiny-npm-package-and-publish-it-2881d4307f78/" rel="noopener noreferrer nofollow">this publiation</a>.
Web based approval system
With the COVID-19 and the introduction of remote work, a many Japanese companies were struggling with the approval of documents, since those needed to be physically stamped with one's personal seal named Hanko.
I decided to solve this issue by creating a web application to keep track of approvals
Testing in NodeJS with Mocha
Mocha is a popular testing framework for NodeJS. it can be installed using npm:
Express authorization middleware
Many applications require some form of authorization mechanism to prevent users from accessing restricted content. Authenticated users are commonly in possession of a cookie containing identification data. With the authentication microservice that I designed, this cookie contains a JWT that contains the user's username. This JWT is sent in the authorization header of HTTP requests. Thus, authorization can be performed easily within each application by simply decoding the JWT. To do so, I designed this simple middleware for ExpressJS.
NodeJS app dockerization
NodeJS apps can be containerized using the <code>docker build</code> command. This article is based on <a href="https://nodejs.org/de/docs/guides/nodejs-docker-webapp/" rel="noopener noreferrer nofollow">this guide</a>.
Puppeteer setup for NodeJS
Puppeteer is a headless browser with which NodeJS can interact to automate web pages manipulation.
connect-history-api-fallback ignore certain routes
For example, if the route /file needs to be handled by express and not the single page application:
NodeJS modules
A JavaScript file can be imported as a module into another file using the <code>require</code> command. For example, he file myPackage.js can be imported as so:
Node.js testing for multiple environment variables
Some applications might require the same codebase to be tested with different sets of environment variables. This article proposes a simple way to do so.