First things first. We need to get the tooling ready so you can take full advantage of Node.js and its libraries to build the API for Emvents Inc. You will build this Node.js API using Express.js, ES6 features and a testing approach that is solid while easy to understand.
-
Check the new JavaScript features (ES6): This new version of JavaScript brings a lot of new things to the language. Take a look at some of them and focus on understanding how to use arrow functions and let/const. http://exploringjs.com/es6/
-
Install Node.js: Follow the steps in this guide to install Node.js in your computer. This is the main "language" we will use to build the API. https://nodejs.org/en/download/
-
Install Postman: This tool will be extremely useful while testing and playing with the API you will build. https://www.getpostman.com
-
Learn about git: You should use git commit after completing each requirement to keep track of every change. https://git-scm.com/docs
-
Review the basic HTTP methods: The API you will build show respond to multiple types of requests. Learn more about the different type of HTTP methods so you can pick the right one. https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods
-
Your project should start with a server.js file with the content of the official Node.js Hello World example.
- Link: https://nodejs.org/api/synopsis.html
- Run it from your terminal
- Check the results in your browser
-
You should use npm to initialize a new Node.js project
- Provide a description
- Provide server.js as the starting file
- Check the resulting package.json file
- Link: https://docs.npmjs.com/cli/init
-
You should use npm to install Express.js
-
You should add Express.js to your project
- Replace your Hello World example with the one provided by Express.
- Link: http://expressjs.com/en/starter/hello-world.html
-
You should add a GET and a POST handler to send and receive data from the client.
- They should return a string for now.
- Link: http://expressjs.com/en/starter/basic-routing.html
-
You should use Postman to test that your basic service works
- Check that both routes are returning the right answer
-
You should refactor your Express.js code to use ES6 features
- You should use const and let to define constants and variables
- You should use arrow functions when appropriate
NOTE: Do you want to become a remote software developer? Join our online training program where students from all around the world learn together doing remote pair programming, all while working on open source and freelance projects.