Table of Contents
The project consists in creating two end-points or APIs, an end-point must allow the insertion in the database of a polluted location with relative image; and the other allows you to view a list of locations with images.
- List of all polluted locations with images :
http://localhost:85/allPlaces
- Create a place with its image :
http://localhost:85/addlPlace
- Clone the repo :
git clone https://github.com/pierre1590/start2impact-Nodejs.git
- Setup a MySQL Database;
- Import the migration file
polluted_cities_places.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" : ""
}
}
- Create a "public" folder and in the latter create another folder called "images" for uploading images.
- Install project dependencies :
npm install
- Start the server :
npm start
- Node.js
- MySQL
- Multer
- Sequelize
- uuid
- 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.
Piero Sabino - @SabinoPiero - P137ru590 - Piero Sabino - [email protected]
Project Link: https://github.com/pierre1590/start2impact-Nodejs