Trybe is a technology school focused on training Web Developers and the Blogs API project was proposed as an activity to improve studies on back-end development.
The application is an API and a database with the content of a blog. It must allow creating, reading, updating and removing blog information from the database. It also performs authentication to grant permissions to users.
In the elaboration of the RESTful API, the Model-Service-Controller(MSC) architecture was used.The other technologies and tools were:
To run the application start with the repositorie clone using the command bellow.
git clone [email protected]:larissaperinoto/blogs-api.git
Navigate to the project root
cd blogs-api/
Running locally
Obs: To run the application this way you must have [Node](https://nodejs.org/en/) installed on your machine.
In the root of the project run the command below to install the dependencies.
npm install
Login to the database using your credentials.
mysql -u <your-username> -p
Run the commands to create the BlogsApi database
npm prestart
Start the application with nodemon using the command bellow.
npm debug
Running with Docker
Obs: To run the application this way you must have Docker installed on your machine.
In the root of the project, upload the blogs_api and blogs_api_db containers using docker-compose.
docker-compose up -d
Open the blogs_api container terminal.
docker exec -it blogs_api bash
Once in the container terminal, run the command below to install the dependencies.
npm install
To connect with database, open the blogs_api_db container terminal.
docker exec -it blogs_api_db bash
Login to the database using the credentials described in the docker-compose.yaml.
mysql -r root -p
To create the database, run the command bellow in the blogs_api container terminal.
npm prestart
To start the server with nodemon use the command bellow in the terminal of the blogs_api container.
npm run debug
You can check all routes by accessing the /docs endpoint in your browser when running the application.
Developed by Daniel Outeiro, © 2022.