It's a simple REST API built in NodeJS that allow users to enroll in courses of some kind of institution and manage their bills. It just has the minimum requirements of CRUD. Built for a job interview.
This is a simple REST API that demonstrate CRUD capabilities to manage Students' course enrollments and their bills, authenticate users, and persist data on any database supported by Sequelize.
The purpose of doing this project was a requested exam from a company that I had a job interview, and also, sure, learn more about technologies and stack involved on it.
In this project, particularly, I've got a struggle to make 'delete on cascade' working as I did choose to use Paranoid (Sofdeletes). I'm glady that after reading a lot on web (Google, Stackoverflow and Medium are always helpful) it did work! 😄😎
I appreciated the opportunity of doing this small project and hope it will be useful somehow to anyone out there.
I let all CRUD in the public routes INTENTIONALLY. This is for making easier and quickier an demonstration during job interview. That way I didn't need to worry about authenticating a user and needing to put the token in every request. Life is already hard enough, let this one make mine better. 🤣🤣
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes..
You need a database server installed and running on your local machine. I've used PostgreSQL on this project.
Then, you can use a default user postgres
and database postgres
or create and use your own. It's up to you.
After that, it's time to setup the project.
Clone this repository to your local machine.
$ git clone https://github.com/trepichio/Billinho/Billinho.git
Enter the root folder of the cloned project.
Rename .env.example
file to .env
and input them as values of their respectives variables in the .env file
The variables are pretty much self-explanatory.
Install dependecies. In your terminal, run:
$ npm install
Now, you have to migrate the tables to database. At the root of project folder, run:
$ node_modules/.bin/sequelize db:migrate
then, seed data to the tables.
$ node_modules/.bin/sequelize db:seed:all
You are ready to go:
$ npm start
Now, you can use any REST Client you like and consume any of API endpoints such as
GET http://localhost:3000/pub/instituicoes?page=1&limit=4 HTTP/1.1.
If you use Visual Code there is a very useful extension that works like a REST Client. See here.
In case, you decided to go and use this extension, enjoy the request.rest
file I've already done for you. Enjoy! 😎
Explain how to run the automated tests for this system.
Explain what these tests test and why
Give an example
Explain what these tests test and why
Give an example
Add notes about how to use the system.
- PostgreSQL - Relational Database
- Sequelize - promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server
- Express - Server Framework
- NodeJs - Server Environment
João Trepichio |