A real project with knowledge objective!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This project consists of an REST API that uses JSON Web Tokens to authenticate users and uses the MVC pattern in its structure, but with a small modification, we just added a service layer where the business logic is, we treated each service separately, making it easier to maintain the code and understand it.
- RESTful API - https://aws.amazon.com/what-is/restful-api/ and https://www.ibm.com/topics/rest-apis
- JSON Web Token - https://jwt.io/
- MVC Pattern - https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
The folder structure was designed to leave each module isolated to facilitate maintenance and future scalability of the application, however within each module contains the CONTROLLER, DATA MODEL, ROUTES AND SERVICES.
Exemple user folder:
- user
- controller
- UserController.ts
- model
- UserModel.ts
- routes
- user.routes.ts
- services
- CreateUserService.ts
- DeleteUserService.ts
- ListUserService.ts
- UpdateUserService.ts
- controller
Some technologies we used to build the project.
- Node - https://nodejs.org/en
- Express - https://expressjs.com/
- TypeScript - https://www.typescriptlang.org/
- Knex - https://knexjs.org/
- Postgres - https://www.postgresql.org/
This project was coded in Node JS, which is a server-side JavaScript execution environment, not depending on the browser as we normally use JavaScript for the front-end, here we can create servers for static and dynamic websites, APIs and microservices based systems.
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. With it we have the creation of routes, middleware, request handling, responses and errors in a consistent and simple way. The learning curve is not very big and Express is one of the most consolidated frameworks for Node JS.
TypeScript is an open source programming language developed by Microsoft. It is a strict syntactic superset of JavaScript and adds optional static typing to the language and features that are not natively present in the language. Types provide a way to describe the form of an object, providing better documentation and allowing TypeScript to validate that your code is working correctly.
Knex is a query-builder built for Node.js that interacts with relational databases. Knex is able to easily access and interact with the relational database of your application. Unlike Sequelize, which is an ORM, Knex is just a query-builder.
PostgreSQL is a related database manager that greatly optimizes the work of anyone who needs to administer information at these levels. The tool is easy to install and practical to use, providing a number of advantages, especially with the use of extensions.
- Authentication
- Authorization
- User Service - CRUD
- Product Service - CRUD
- Email Service
- Multi-language Support
- English
- Spanish
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch - (
git checkout -b feature/AmazingFeature
) - Commit your Changes - (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch - (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Jose Carlos Sant'Anna - Twitter @Ze_Ca_
Linkedin - https://www.linkedin.com/in/josecarlossantanna/
Email - [email protected]
Project Link: https://github.com/jcsj89/api-santana