
This will cover the key concepts required to set up a server, which will provide the foundation necessary to return more complex data formats like JSON.įirst, we need to set up an accessible coding environment to do our exercises, as well as the others in the article. Let’s start by creating a server that returns plain text to the user. If you’re not familiar with asynchronous programming in Node.js or the fs module for interacting with files, you can learn more with our article on How To Write Asynchronous Code in Node.js.

To install this on macOS or Ubuntu 18.04, follow the steps in How to Install Node.js and Create a Local Development Environment on macOS or the Installing Using a PPA section of How To Install Node.js on Ubuntu 18.04. This tutorial uses Node.js version 10.19.0.

Back-end code is concerned with how data is exchanged, processed, and stored. Front-end code is concerned with how the content is presented, such as the color of a navigation bar and the text styling. This software generally falls into two categories: frontend and backend. A web server receives HTTP requests from a client, like your browser, and provides an HTTP response, like an HTML page or JSON from an API.Ī lot of software is involved for a server to return a webpage. That computer you are talking to via the internet is a web server. When you view a webpage in your browser, you are making a request to another computer on the internet, which then provides you the webpage as a response. The author selected the COVID-19 Relief Fund to receive a donation as part of the Write for DOnations program.
