Code Challenge Week 4 "Cursos de Visual Thinking API".
-
Creating a endpoint to consult all students information.
-
Creating a endpoint to consult all student's emails with
haveCertification
certification. -
Creting a endpoint to consult all students with
credits
greater than 500.
- Go Code Challenge repository.
- Click code
- Copy the URL: SSH or HTTP
- Go your terminal and run command
git clone <URL>
- Done. We clone my repository.
This proyect need dependencies Jest, Express, EsLint and Supertest.
- Run:
npm install
to create node_modules files.
If don´t install it, run:
- Jest:
npm install --save-dev jest
- Express:
npm install express --save
- Eslint:
npm install eslint --save-dev to install dependence and
npm init @eslint/config` to configure the rules. - Supertest:
npm install supertest --save-dev
- Jest: Testing Framework to test my code.
Version 27.5.1
- Express: Web framework to creating API´s and http methods.
Version 4.18.1
- Supertest: Used it to run testing with a http method server.
Version 6.2.3
- Eslint: Used it to find and fix syntax errors and standirse code.
Version 8.15.0
graph TD;
Reader-->studentController
studentService-->studentController
studentController-->server
I separated responsibilities:
- Service: gives functionality to projects: get all students, get all emails and get all students with credits greater than 500.
- Reader: gives auxiliary class to read JSON files.
- Controller: is a connection with the server.
- Run
npm run server
in command line. - The server should be ready, enter endpoints in your browser and will see the API.
- Run tests
npm test
EsLint help us to find and finx syntax error and gives a style guide about standirse code. Here use Airbnb JavaScript Style Guide Version 15.0.0
- Run
npm run linter
to find syntax errors. - Run
npm run linter --fix
to fix all syntax errors automatically.