A RESTful API that uses MSC architecture to manage a Blog's posts and users. Developed at Trybe's Back-end Module, ORM.
- Welcome to Blogs API project!
- Summary
- Context
- Technologies, tools and architectures used
- Installing and running the app
- Notes
This project is a Blogs API that uses Sequlize to connect with a MySQL database to manage posts and users. A few notable points:
- Authentication and Authorization | Users can view and create any post as long as they're logged in. But, they can only edit and delete posts created by them.
- Validation | User input is validated through middlewares, whilst business rules are validated in the Service layer.
- Tests | Most of the the tests are integration, with a few unit tests for middlewares. Category routes are still to be tested, to improve test coverage.
This project used the following technologies and tools:
- Node.js, Express, Nodemon, Joi, JWT | Create a HTTP API, API routing, improve API development, data validation, authentication and authorization.
- Sequelize | ORM, create relationships between entities.
- Mocha, Chai, Sinon | Integration and unit testing for Node.js.
- MSC Architecture | Improve code organization, maintenance and scalability.
- REST Architecture | Simple architecture and highly popular.
Blogs API Tests and MSC architecture diagram.
cd blogs-api
npm install
Don't forget to create and setup an .env
file to connect to your local MySQL. See .env.example
for avaiable variables.
cd blogs-api
npm run debug
cd blogs-api
docker-compose up -d
docker exec -it blogs-api bash
npm install
npm run debug
Run all tests
npm run test
Run a specific test
NAME=<testsname> npm run test
See test coverage
npm run test:coverage
npm run lint
API's documentation can be found here.
To enforce Clean Code and good practices, the following standards and resources were used in this project:
- Linter | Developed following the Clean Code standards specified by Trybe's ESLint.
- SonarCloud | Passing SonarCloud's quality standards and analysis. Check the evaluation here.
Commited using the Conventional Commits specification with some types from Angular convention.