Description

A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.

RESTful Web APIs allow developers to create modern applications by leveraging the data on the Internet. Since JavaScript is the language of the web, building APIs using Node.js provides a seamless development experience on both the front end and the back end.

In this course, we will build APIs for Music application. There are two roles(Artist, User) in our demo application.An artist can create/edit/delete the song. A user can view all the songs. A user can also create and view the songs playlist.

You will learn how to create the Apis for users, and artists. I will teach you how to add JWT authentication in Nodejs. I will also show you how to add role-based authentication in real-world application

You'll learn to:

how to setup the ES6 server with NodejsLearn how to build CRUD(Create, Read, Update and Delete) APIs with Nodejs and MongooseLearn how to write documentation for the APIs using SwaggerLearn how to add JWT authentication with ExpressJsLearn how to implement role based authenticationDeploy NodeJs API to HerokuThis course is for you if:

You’re a back-end developer who is used to working with frameworks like ASP.NET, Rails, Django, etc. You want to add Node.js to your toolbox.

You’re a front-end developer and want to transition to full-stack development.

You’ve tried other Node.js tutorials and found them to be too slow, out-of-date, and boring!

Having Node.js on your resume helps you find more jobs and make more money.

DescriptionWe will learn how to create the Node.Js server from scratch and adding ES6 support through babel-cli

4
Connect to MongoDB
01:26 min

DescriptionMongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in typecasting, validation, query building, business logic hooks and more, out of the box. You will learn how to integrate MongoDB using mongoose package.

5
Create NodeJs Project structure feature by feature
03:35 min

DescriptionIn this lesson, you will how to the design the project structure for our demo application. You will learn the best practices to design the app structure

6
Create a Model in Mongoose
01:48 min

DescriptionModels are fancy constructors compiled from Schema definitions. An instance of a model is called a document. Models are responsible for creating and reading documents from the underlying MongoDB database

7
Add validations for Request params using Joi package
04:16 min

DescriptionImagine you run facebook and you want visitors to sign up on the website with real names and not something like l337_p@nda in the first name field. How would you define the limitations of what can be inputted and validate it against the set rules?
This is joi, joi allows you to create blueprints or schemas for JavaScript objects (an object that stores information) to ensure validation of key information.

Chapter 2:
CRUD Operations with NodeJs and Mongoose

1
Create New Record in MongoDB
01:15 min

DescriptionIn this lesson, you will learn how to create an HTTP POST endpoint to save the song into MongoD

2
Find All Records From MongoDB
01:15 min

DescriptionIn this lesson, you will learn how to create an HTTP GET endpoint to fetch all the records from MongoDB

3
Pagination in Mongoose
03:33 min

DescriptionPagination is the process of separating print or digital content into discrete pages. It Refers to numbering pages in a document. It also Refers to dividing a document into pages. We are going to use `mongoose-paginate` plugin for pagination in mongoose

4
Find Single Record by Id
02:00 min

DescriptionIn this lesson, you will learn how to find the single record from the MongoDB. You will also learn how to send the routing param in express

5
Delete Record From MongoDB
01:53 min

DescriptionI will show you how to delete the record from MongoDB using delete endpoint

6
Update Record in MongoDB
02:54 min

DescriptionYou need to create the HTTP PUT endpoint to update the record .You will earn how to edit the existing song in the MongoDB.

Chapter 3:
Documentation for REST APIS with Swagger

1
Swagger Documentation Setup
02:28 min

DescriptionSwagger is the world’s largest framework of API developer tools for the OpenAPI Specification(OAS), enabling development across the entire API lifecycle, from design and documentat

2
Create Definition Model in Swagger
01:11 min

DescriptionPrimitive data types in the Swagger Specification are based on the types supported by the JSON-Schema Draft 4. Models are described using the Schema Object which is a subset of JSON Schema Draft 4.

3
Add Documentation for POST Endpoint
03:47 min

DescriptionIn this lesson, you will learn how to add the documentation for the create record endpoint.

4
Documentation for Find All Records
04:28 min

DescriptionIn this lesson, you will learn how to add the documentation for the find all songs endpoint.

5
Documentation for FindOne Record
02:58 min

DescriptionIn this lesson, you will learn how to add the documentation for the find song endpoint

6
Documentation for Delete Record
01:13 min

DescriptionIn this lesson, you will learn how to add the documentation for the delete song endpoint

7
Documentation for Update Endpoint
02:27 min

DescriptionIn this lesson, you will learn how to add the documentation for the update song endpoint

Chapter 4:
Authentication and Authorization

1
Create a User Model
01:38 min

DescriptionAn authenticated user can create playlists and view all the songs. In this lesson, I will show you how to create a user model in Mongoose

2
Create Signup Route
05:13 min

DescriptionIn this lesson, we will create a signup route for user registration.

3
User Registration
03:53 min

DescriptionA user can create the new account in our system. I will show you how to encrypt the user password and save new user in MongoDB.

4
Documentation for Signup
04:47 min

DescriptionIn this lesson, you will learn how to add the documentation for the user signup endpoint. We will create a new user model in Swagger definition model file.

5
User Login
04:22 min

DescriptionAn authenticated user can view all the songs. You will learn how to implement the login feature

6
Send JWT Token After LoggedIn
03:07 min

DescriptionIn this lesson, we will create a json web token using jwt package.JSON Web Token (JWT) is a means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is digitally signed using JSON Web Signature (JWS) and/or encrypted using JSON Web Encryption (JWE)

7
Documentation for User Login
02:57 min

DescriptionIn this lesson, we will create a documentation for user login endpoint. We will use the same user definition model for adding documentation

8
Configure Passport JWT Strategy
07:19 min

DescriptionPassport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more.
Passport-JWT is a strategy for authenticating with a JSON Web Token.
This module lets you authenticate endpoints using a JSON web token. It is intended to be used to secure RESTful endpoints without sessions.

9
Apply Authentication on Routes
01:32 min

DescriptionRoute middleware is an extremely powerful tool in Node.js and Express. As an example of how powerful Express's route middleware can be, the awesome Passport.js that handles authentication is a route middleware tool.

10
Add Authentication Header in Documentation
01:47 min

DescriptionUnfortunately request doesn’t come with an easy convenience parameter you can use, so you need to provide it by yourself. The common way is to add it as an extra HTTP header.In this lesson, we will add documentation for Auth header in Swagger

Chapter 5:
Role Based Authentication

1
Add Role for User
03:16 min

DescriptionIn our demo Application we have two roles, artist role and user role. Artist can create, delete and update the songs. A standard authenticated user can view all the songs and create playlists

2
Role Based Authentication
03:56 min

DescriptionRole-based access control (RBAC) is a method of regulating access to computer or network resourcesbased on the roles of individual users within an enterprise. In this context, access is the ability of an individual user to perform a specific task, such as view, create, or modify a file.

3
Documentation for User Role
00:24 min

DescriptionIn this lesson, we will add documentation for user role in swagger document

Chapter 6:
Add Relationship Between Mongoose Models

1
Add Relationship between Models
02:27 min

DescriptionMongoDB has the join-like $lookup aggregation operator in versions >= 3.2. Mongoose has a more powerful alternative called populate(), which lets you reference documents in other collections.
Population is the process of automatically replacing the specified paths in the document with document(s) from other collection(s). We may populate a single document, multiple documents, plain object, multiple plain objects, or all objects returned from a query. Let's look at some example

2
Population in Mongoose
01:46 min

DescriptionPopulation is the process of automatically replacing the specified paths in the document with document(s) from other collection(s). We may populate a single document, multiple documents, plain object, multiple plain objects, or all objects returned from a query. Let's look at some examples.

3
One to Many Relationship between Models
01:51 min

DescriptionIn this lesson, we will show you how to develop One-to-Many related document with NodeJs/Express, MongoDB using Mongoose.

4
Save PlayList
07:08 min

DescriptionIn this lesson, we will save new record in mongoose model.

5
Populating Multiple Paths
01:41 min

DescriptionPopulation is the process of automatically replacing the specified paths in the document with document(s) from other collection(s). We may populate a single document, multiple documents, plain object, multiple plain objects, or all objects returned from a query. Let's look at some examples. You will learn how to populate multiple records in a single document

6
Documentation for Multiple Paths
02:15 min

DescriptionIn this lesson, we will add documentation for multiple paths in Swagger document. We will update our definition model object in swagger

Chapter 7:
Deploy Nodejs App to Heroku

1
Heroku Setup with Mongo Lab
02:02 min

DescriptionHeroku is a cloud platform that lets companies build, deliver, monitor and scale apps — we're the fastest way to go from idea to URL, bypassing all those infrastructure headaches. Heroku is a service that enables companies to spend their time developing and deploying apps .
mLab is the leading Database-as-a-Service for MongoDB, powering over half a million deployments worldwide.

2
Create New Heroku App for Production
02:12 min

DescriptionHeroku cli provides a create command to create new heroku application. The command’s output shows that the app will be available at http://example.herokuapp.com. The second URL, https://git.heroku.com/example.git, is the remote git repository URL; by default, the heroku create command automatically adds a git remote named “heroku” pointing at this URL.

3
Setup Configuration for Development and Production
05:27 min

DescriptionIn this lesson, we will create API KEYS for both production environment or development environment

4
Deploy Nodejs App to Heroku
04:20 min

DescriptionHeroku manages app deployments with Git, the popular version control system. Before you can deploy your app to Heroku, you need to initialize a local Git repository and commit your application code to it.
Git remotes are versions of your repository that live on other servers. You deploy your app by pushing its code to a special Heroku-hosted remote that’s associated with your app.
To deploy your app to Heroku, you typically use the git push command to push the code from your local repository’s master branch to your heroku remote, like s

5
Refactor Hostname in Swagger
03:38 min

DescriptionIn this lesson, we will refactor the hostname for the heroku server in the Swagger document file.

Haider Malik is the founder of fullstackhour. He is a full-stack Javascript developer. He is passionate about everything JavaScript, and he loves exploring new libraries.
He?s had extensive experience developing software and working with teams to improve how software is developed to meet business objectives.Although his primary focus is on outcomes, implementation often includes technical competency