O'Reilly logo
live online training icon Live Online training

Web Services with Node

Create robust RESTful Web Services with Node.js, MongoDB, and Express.js

Tamas Piros

Web APIs allow developers to build web pages and web based applications (known as "mashups") using data from multiple online sources. Representational State Transfer (REST) is a simple yet powerful software architecture style to create lightweight and scalable web services. When building RESTful services, it is really important to choose the right framework. Node.js, with its asynchronous, event-driven architecture, is exactly the right choice for building RESTful APIs.

This course will teach students to create scalable and rich RESTful applications based on the Node.js platform. Students will be introduced to Node.js as well as its package handler, npm in order to install and manage project dependencies.

The course will begin with a quick overview of Node.js (please note that this is not an in-depth Node.js course), followed by understanding the key principle that makes an HTTP application a RESTful-enabled application. After writing a simple HTTP request handler, students should be able to create Node.js modules and first the RESTful API will be using static data, while later on in the course students will explore using a NoSQL database, MongoDB for data storage and they’ll learn how to dynamically get data out from the database and display that via the RESTful API. During the course students will get familiar with the basics of REST API design, including but not limited to HTTP status codes and responses as well as get an introduction to ExpressJS – a popular web server for Node.js. Lastly, students will be able to add authentication using JWT (JSON Web Tokens) to secure endpoints in the API.

What you'll learn-and how you can apply it

  • Explore the new features of Node.js 10, Express 4.0, and MongoDB
  • Create rich and scalable RESTful API solutions from scratch
  • Integrate MongoDB in your Node.js application to store and secure your data
  • Secure your services with NoSQL database integration within Node.js applications

This training course is for you because...

  • If you are keen to enrich your development skills to create server-side RESTful applications based on the Node.js platform then this course is for you. It will teach you the fundamental of REST API design in a pure Node.js environment using some of the most utilized packages within the ecosystem.
  • The knowledge that you’ll gather during this course can be put down into practice straight away after the course and will accelerate your ability to develop robust web services.
  • The course will keep extensibility and scalability in mind, so you can immediately start to create REST APIs that scale.

Prerequisites

  • Basic web development knowledge
  • Understanding of JavaScript
  • Basic understanding of NoSQL

Recommended Preparation:

Beginning API Development with Node.js (video)

Materials, downloads, needed in advance:

About your instructor

  • Tamas is a Developer Evangelist with a decade of experience in full-stack web development as well as a robust technical instructor background, and has a decade of experience working with customers and training them in technologies including but not limited to JavaScript, Angular, Node.js, TypeScript, XQuery, Java, NoSQL and related database technologies and methodologies.

    Throughout his career Tamas has delivered technical training sessions to large, multinational organisations such as Verizon, Orange, BBC, Accenture, Panasonic, Credit Suisse, Deutsche Bank and OECD to mention a few. On top of the training sessions, Tamas also regularly conducts workshops and presentations all over the world. He spoke at prestigious conferences that include HTML5 DevConf in San Francisco and JSConf Asia in Singapore among various others and at a significant number of meetups throughout Europe.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

DAY 1 – 4 hours

  • Section 1: Getting the environment setup
  • Section 2: Introduction to Node.js & npm
  • http module, fs module, path module
  • debug and development tools – Winston, nodemon
  • Section 3: Introduction to Express
  • Setup and configure express
  • Create a single API endpoint
  • Handle static files
  • Use the Router object
  • Create multiple endpoints for HTTP methods
  • Query and route parameters
  • Creating a static API with Express with the appropriate endpoints

DAY 2 – 4 hours

  • Section 4: Using MongoDB
  • Load data to MongoDB
  • Query data in MongoDB (Basic query types)
  • Section 5: Recreating the API to use data from MongoDB
  • Update the API from Day 1 to display data from MongoDB
  • Section 6: Advanced ExpressJS
  • Understanding Middlewares
  • Section 7: Adding authentication to the API (JSON Web Tokens)
  • Securing a single endpoint with JSON Web Tokens