Blogs API Project is a RESTFul API developed in the Back-end Module at Trybe Web Development course.
It is a posts and users management system for a blog that presents all the CRUD methods.
- Kanban
- Scrum
Cloning the repository and installing node modules
- Clone the repository
-
git clone git@github.com:carlosaflach/Blogs-API.git
; -
Enter in the folder that was created in the cloning process:
cd Blogs-API
;
- Install the dependencies
npm install
ounpm i
;
🎲 Configuring the database connection
- Creating the configuration file
-
Create an .env file in the project root:
touch .env
;
-
Place the following information in the .env file and replace with your credentials:
NODE_ENV=development API_PORT=3000
MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_DB_NAME=blogs-api MYSQL_USER=yourUser MYSQL_PASSWORD=yourPassword
JWT_SECRET=yourSecret ```
NOTE: You will need to create a local database to use this API. In this manual, I called the database name as blogs-api, but you can call it whatever you want. It's just important that you make sure to create one database and configure it at the .env file to the API work properly.
🏃 Running the API locally
-
Run the following command in the terminal from the project root::
npm start
;
🐳 Running via Docker
If you wanted and have the knowledge of how to use it, there is a file docker-compose in the root of the project, follow the commands create and access the containers:
-
At the root of the project run the following command:
docker-compose up -d
;
-
To access the container terminal, run the following command:
docker container exec -it store_manager bash
;
-
To close the container terminal, run the command:
exit
;
-
If you are no longer using containers, run the following command:
docker-compose down
;
🚧 Under Construction 🚧