I created this application to practice NodeJS and ExpressJS. The app is organized using the MVC model, it renders templates using a template engine called hbs(Handlebars.js).
The main concepts practiced in this app were:
- How to create an Express.js server
- Middleware
- Routing in Express.js
- The MVC design pattern
- Server side rendering
- Separation of concerns
- RESTful API convention
In order to run this app locally, make sure you clone this repository in your local machine. Instructions to clone a repo. Once you cloned the repository, navigate to the project folder and download the dependencies (all the packages listed in the package.json file necessary for the app to run) by running: npm install
. At this point the app should be ready to run, which you can do with the following command npm start
.
You'll know the server is running when you see this in your terminal:
Once you have the server up and running, you can visit localhost. You can make two types of request, GET and POST.
get-friend pass a number from 0 to 3 to get a different friend
To make POST requests I use a tool called Postman
Again, this is a backend application so the views rendered to the client(front-end) are very simple.