Chapter 3. What is a Node web application?
This chapter covers
- Creating a new web application
- Building RESTful services
- Persisting data
- Working with templates
This chapter is all about Node web applications. After reading this chapter, you’ll understand what Node web applications look like and how to start building them. You’ll do everything a modern web developer does when building an application.
You’re going to build a web application called later that’s inspired by popular read-it-later websites such as Instapaper (www.instapaper.com) and Pocket (getpocket.com). This involves starting a new Node project, managing dependencies, creating a RESTful API, saving data to a database, and making an interface with templates. That might sound like a lot, but you’ll explore each of the ideas in this chapter again in subsequent chapters.
Figure 3.1 shows what the result should look like.
The read-it-later page on the left has stripped away all of the navigation from the target website, preserving the main content and title. More significantly, the article is permanently saved to a database, which means you can read it at a future date when the original article may no longer be retrievable.
Before building a web application, you should create a fresh project. The next section shows how to create Node projects from scratch.
A typical Node web application has the following components: