2 Building a Node web server

 

This chapter covers

  • Using Node as a web interface
  • Building a Node app with Express.js
  • Serving static pages with dynamic content

Node is about using JavaScript on the server. JavaScript itself is already an asynchronous language by nature, but not until 2009 was it used outside your standard web browser. As dependence on the internet grew worldwide, businesses demanded new innovative development strategies that also took into account hirable skill sets already in the market. Thereafter, JavaScript took off for both frontend and backend development, setting up new application design patterns with Node’s single-threaded event loop.

In this chapter, you’ll explore the most common use-case for Node, a web application, and how the event loop plays a role. By the end of this chapter, you’ll be able to use Node’s most popular application framework, Express.js, to build both simple web servers and more extensive applications.

Tools & applications used in this chapter

Before you get started, you’ll need to install and configure the following tools and applications that are used in this project. Detailed instructions are provided for you in the specified appendix. When you’ve finished, return here and continue.

  • Appendix A.1.2 Installing VS Code
  • Appendix A.1.3 Installing Node

2.1 Your prompt

2.1.1 Get planning

2.2 Building the application skeleton

2.2.1 Working with Express.js

2.3 Adding routes and data

2.4 Building your UI

2.5 Sprucing up the UI

2.6 Summary