From the course: Node.js: Web Servers, Tests, and Deployment

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Creating modular projects

Creating modular projects

- [Instructor] One of the principles of Node.js is small modules. This means that, as JavaScript developers, we should take advantage of modularity by breaking code up into bite size modules that are focused on a specific task. So we've brought back the ski dictionary website and the API that we built back in chapter three. So let's take a look at our index.js file. We have actually broken this project down into smaller files. So I wanted to take you on a little tour. First things first, our index file is going to import a file called app from the app.js file, and we'll call app.listen to listen on this port. Then we move to the app.js file. So the app.js file, check it out. We are importing a few different dependencies. We have express, we have body-parser, and we have a couple other custom files that I built. This is going to take care of all of the express stuff for us, so that as I visit certain routes, the…

Contents