A personal budget management 💸 REST API built in Nodejs, Express, Sequelize. AlkemyLabs JS Challenge resolution.
This is the backend (server side) of the myBudget app. To see the frontend (client side) visit the repository: github.com/n-caro/mybudget-frontend
- API RESTFul level 2, node.js (express)
- N-Layer architecture
- routes
- controllers
- services
- repositories
- SQL Database, with Sequelize ORM
- Authentication: JWT (Json Web Token) and bcrypt for password encryption.
- Dependency injection: (awilix)
- Docs: Swagger
You must create a database and import/run the SQL scripts from folder /database. In the following order
- mybugdetDB-DDL.sql : script for database structure creation (Data Definition Language)
- mybugdetDB-DML.sql : script to add data: types of operations and categories (Data Manipulation Language)
Example with mysql command-line client:
mysql -u username -p myBudgetDB < mybudgetDB-DDL.sql
mysql -u username -p myBudgetDB < mybudgetDB-DML.sql
npm install
Create a .env
file into the root folder. You can edit the .env.example
file and rename it.
.env
APPLICATION_NAME = mybudget-api
DB_CONNECTIONURI=mysql://user:password@localhost:3306/mybudgetDB
JWT_SECRET = 'jwt_secret_key'
JWT_EXPIRATIONTIME = 24h
PORT = 4000
Run script:
npm start
165 / 5000
Resultados de traducción
After seeing the message that the application is running, you can see the documentation and use the endpoints from swagger. http://localhost:/{PORT}/api-docs
(example: http://localhost:4000/api-docs)