📖 Table of Contents:
1. Introduction
2. Creating a Web Book from Scratch
3. Creating the Main Application
4. Creating the School Application
5. Registering Schools in the Main Application
6. Creating Webhook Events
7. Registering Students in the Main Application
8. Sending Webhook Responses to Schools
9. Conclusion
Introduction
In this tutorial, we will be creating a web book from scratch. We will be creating two applications: a main application and a school application. The main application will hold records of all students from various schools, and the school application will be used to register schools. We will be using Node.js as our main server language and MongoDB as our database. We will also be using Postman to check our REST API.
Creating a Web Book from Scratch
Creating a web book from scratch can be a long process, but we will try to make it as simple as possible. We will be creating two applications: a main application and a school application. The main application will hold records of all students from various schools, and the school application will be used to register schools.
Creating the Main Application
The first step in creating the main application is to create a server from scratch. We will be using Node.js as our main server language. We will also be creating a package.json file and an app.js file. The package.json file will behave similar to a Maven in Java or pom.xml. The app.js file will be our server.
Once we have created our server, we will create some APIs. The first API will be used to register schools. The second API will be used to create webhook events. The third API will be used to register students.
Creating the School Application
The school application will be used to register schools. We will be creating a separate application for this. The school application will be running at port number 4100. Whenever we call localhost:4100, we will get a message like “Welcome”.
Registering Schools in the Main Application
In the main application, we will be registering schools. We will be creating an entity class called School Model. We will also be creating a table called schools. Whenever a school is added, all the school details will be added to this table.
Creating Webhook Events
We will be creating webhook events in the main application. Whenever a student is added, we want all the response to be sent to the school application. We will be using a for loop to iterate through all the webhook events.
Registering Students in the Main Application
We will be registering students in the main application. We will be creating an entity class called Student Model. We will also be creating a table called students. Whenever a student is added, all the student details will be added to this table.
Sending Webhook Responses to Schools
We will be sending webhook responses to schools in the school application. Whenever a student is added in the main application, we want all the response to be sent to the school application. We will be using Axios