O'Reilly logo

Express.js Blueprints by Ben Augarten, Marc Kuo, Eric Lin, Aidha Shaikh, Fabiano Pereira Soriani, Geoffrey Tisserand, Chiqing Zhang, Kan Zhang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. A Robust Movie API

We will build a movie API that allows you to add actor and movie information to a database and connect actors with movies, and vice versa. This will make use of the information introduced in Chapter 1, Building a Basic Express Site, and give you a hands-on feel for what Express.js offers. We will cover the following topics in this chapter:

  • Folder structure and organization
  • Responding to CRUD operations
  • Object modeling with Mongoose
  • Generating unique IDs
  • Testing

Folder structure and organization

Folder structure is a very controversial topic. Though there are many clean ways to structure your project, we will use the following code for the remainder of our chapters:

chapter2 ├── app.js ├── package.json ├── node_modules │└── ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required