So far, we’ve been working exclusively with the browser-facing part of our websites: HTML, CSS and frontend Javascript. We’ve been using a simple HTTP server running on a Digital Ocean droplet for serving our website files to the world, but didn’t explore at all what servers can do for us.

Starting with this tutorial, we’re going to dive into backend programming – developing our servers, sending data back and forth between the browser and the server, storing that data, and reflecting user-inflicted changes on our websites. All of this is working towards the goal of building more complex websites: ones which are able to host, process and display user generated content.

Quick note on development process

So far we’ve been simply using the Digital ******Ocean droplets for running the web servers. If you haven’t already, it’s a good idea to install Node on your computer (download it from https://nodejs.org) and start running your servers locally as well. This will make for a much faster development cycle, where code changes for both the frontend and the backend are reflected instantaneously, and can be deployed to the Digital Ocean droplet once your website is ready.

Setting up a Node project on your computer

Use nodemon watcher for development

Exposing the public directory for static files

Defining routes

Serving dynamic files

HTML Forms: sending data over with a GET request