This is a study project, based on Alura's course about NodeJS and RestAPI.
The idea is to create an appointment service to a Pet Shop.
- NodeJS
- Express
- MySQL2
This project is hosted at Heroku.
[
{
"id": 2,
"client": "Alberto Jr",
"pet": "Meg",
"service": "Tosa e Banho",
"date": "2022-02-13T03:00:00.000Z",
"dateCreation": "2022-02-06T18:33:18.000Z",
"status": "Agendado",
"observation": "Muito amigável"
},
{
"id": 3,
"client": "Nathalia",
"pet": "Tag",
"service": "Tosa e Banho",
"date": "2022-02-13T03:00:00.000Z",
"dateCreation": "2022-02-06T20:46:25.000Z",
"status": "Agendado",
"observation": "Não gosta que mexa nas patinhas!"
}
]
Fields:
- client
- pet
- service
- status
- observation
- date
Response:
[
{
"id": ${service_id}
}
]
You must install the dependencies
npm install
And create a MySQL database and user:
CREATE DATABASE appointment_petshop;
CREATE USER 'petshop_admin'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, INDEX, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON appointment_petshop.* TO 'petshop_admin'@'localhost';
These settings can be changed using a .env file on root folder. Example:
PORT="3000" #node app port
DATABASE_URL="localhost"
DATABASE_PORT="3306"
DATABASE_USER_ID="petshop_admin"
DATABASE_USER_PASSWD="password"
DATABASE_NAME="appointment_petshop"
npm start