Table of Contents
The project consists in the creation of 7 APIs or endpoints, three for registration, login and logout; and the other 4 allow a user to create, edit, delete or view all posts.
- Registration :
(Method:POST) http://127.0.0.1:8080/auth/register
- Login :
(Method:POST) http://127.0.0.1:8080/auth/login
- Logout :
(Method:DELETE) http://127.0.0.1:8080/auth/logout
- Create a post :
(Method:POST) http://127.0.0.1:8080/feed/posts
- Edit a post :
(Method:PUT) http://127.0.0.1:8080/feed/posts/:id
- List all posts :
(Method:GET) http://127.0.0.1:8080/feed/posts
- Delete a post :
(Method:DELETE) http://127.0.0.1:8080/feed/posts/:id
- Clone the repo :
git clone https://github.com/pierre1590/Back-end_project_start2impact
- Setup a MySQL Database;
- Import the migration file
migration_script.sql
- Create a nodemon.json file and fill it with your DB data:
{
"env" : {
"NODE_PORT" : "",
"NODE_DATABASE" : "",
"NODE_DATABASE_USER" : "",
"NODE_DATABASE_PW" : "",
"NODE_DATABASE_URL" : ""
}
}
-
In the root folder, create a directory named
Public
and in this last folder create another folder calledimg
to allocate the images. -
Install project dependencies :
npm install
- Start the server :
npm start
- Body-parser
- Express-validator
- Node.js
- MySQL
- Sequelize
- JSON Web Tokens
- Bcryptjs
- Multer
- uuid
- nodemon
- Express.js
To verify that the end-points worked I used Talend API Tester - Free edition, but you can also use other apps like Postman.
- Create a project.
- Add a request.
- Select the method(GET,POST,...) and type the link in the address bar:
http://localhost:port/
- Click on the "save" button and then on the "send" button.
- You will see the response.
Piero Sabino - @SabinoPiero - P137ru590 - Piero Sabino - piero.sa@icloud.com
Project Link: https://github.com/pierre1590/Back-end_project_start2impact