Adding custom headers to the response object of of an Azure Function written in Node sounds simple. Turns out it may not be as simple as it sounds.
Setting up an API with NodeJs and Express is a topic that is well covered and documented. But what happens when your API requirements expand beyond having a simple CRUD offering? API versioning can help with this. Anytime you see an API url with /v1/ in it, the API is using an internal versioning setup. In this post we'll cover one simple way to configure this with NodeJs and Express.
Every full-stack application in production today probably connects to a database of some variety, whether that be a NoSQL database like MongoDB, a MySQL database like MariaDB, a SQL Server database like those provided by Azure or any other variety. This means that knowing how to wire up a stable connection to these databases from your NodeJs API is a critical skill.
REST APIs are a key building block of the Internet as we know it, along with being an essential component of any full-stack web application by providing a bridge between our users and our database. Luckily, an API can be built using many different technologies and languages. If you're a web developer with Javascript knowledge, using NodeJs to build an API is a no-brainer.
Step-by-Step guide to setting up an express server to run as a realtime chat server
Deploying a NodeJs app to an Ubuntu Virtual Machine hosted with Azure using Azure DevOps should be pretty straightforward. Turns out, it is quite a lot more finicky than might appear!
Building an API with NodeJs and Express is always a key building block of any full stack application. In conjunction with managing user requests, a NodeJs API application can also help maintain database integrity by performing scheduled maintenance checks to ensure everything remains in solid working order.
Environment variables in NodeJs are essential for setting configuration options as well as storing important values securely. The environment variables allow you to store API keys and other configuration secrets independently from your main codebase and separate from your git repository so they never get checked in anywhere. Being able to configure and consume these variables is essential in creating solid, production-ready NodeJs APIs for all applications.
Often, by default, an Azure Function written in NodeJs stringifies the response object being returned. This results in unnecessary JSON parsing on the client in order to be able to process the response. Luckily, we can avoid this by making a simple change to the Azure Function to ensure the object is returned.
Memoization is a term you will come across at some stage when reading about frontend frameworks, libraries and in various packages you may need to use. This post will explain what memoization is, why use memoization and how to implement memoization.
Web server caching is the storage of frequently accessed data in a secondary, temporary location to reduce the overall load on a web server. Caching allows data to be served directly from memory which can be faster and more efficient than making multiple connections to the actual database.