Project from collecting tags of links.
# Clone repository
git clone
# Access file
cd web
# Copy the .env.example file and put the correct environment variables in the .env
cp .env.example .env
# Instale as dependΓͺncias
npm install
# Run project
npm start or node server.js
# Run project test
npm test https://www.mongodb.com/# Database
MongoDB
# Librarys used
- @types/jest
- cheerio
- dotenv
- express
- jest
- mongoose
- node-fetch
- supertest
Endpoint generic: http://localhost:3000/
| Method | Description |
|---|---|
/api/status/status() |
Test the status from project |
/api/status/status_test() |
To test in unit test |
/api/books/books_status() |
Test the status from route |
/api/books/booksPostUrl() |
Get the link: http://books.toscrape.com/catalogue/page-1.html and save it to the database |
/api/books/booksGetUrl() |
Search all data saved in the database |
/api/pilots/pilots_status() |
Test the status from route |
/api/pilots/pilotsPostUrl() |
Get the link: https://www.formula1.com/en/drivers.html and save it to the database |
/api/pilots/pilotsGetUrl() |
Search all data saved in the database |
{
"author": "Anderson Giusti"
}{
"message": "Consulting books with successfully!",
"books": [
{
"_id": "636935bca457f6f4a80a63ee",
"link_image": "http://books.toscrape.com/media/cache/2c/da/2cdad67c44b002e7ead0cc35693c0e8b.jpg",
"link_catalogue": "http://books.toscrape.coma-light-in-the-attic_1000/index.html",
"created_at": "2022-11-07T16:43:40.096Z",
"__v": 0
},
]
}{
"success": true
}{
"message": "Consulting pilots with successfully!",
"pilots": [
{
"_id": "636935a6a457f6f4a80a63c2",
"photo": "https://www.formula1.com/content/dam/fom-website/drivers/M/MAXVER01_Max_Verstappen/maxver01.png.transform/2col/image.png",
"link": "https://www.formula1.com/en/drivers/max-verstappen.html",
"created_at": "2022-11-07T16:43:18.308Z",
"__v": 0
},
]
}{
"success": true
}Node.js server, used the routes, converted the data to Json and made connection with db.
Managed the MongoDb configuration environment variable.
Created the routes only with the responsibility of the HTTP methods.
Created the logic and saved the db information.
Modeled the data schema for the bank.
Unit test.
π web
|
|- π src
| | |
| |- π controllers
| |- π books.controller.js
| |- π pilots.controler.js
| |- π status.controler.js
|
| |- π models
| |- π books.model.js
| |- π pilots.model.js
|
| |- π routes
| |- π books.router.js
| |- π pilots.router.js
| |- π status.router.js
| |- π app.js
|- π test
| |- π books.test.js
| |- π pilots.test.js
| |- π server.test.js
| |- π status.test.js
|
|- π .dockerignore
|- π .env
|- π .env.example
|- π .gitignore
|- π Dockerfile
|- π jest.config.js
|- π package
|- π server.js
https://cloud.ibm.com/login With plan lite in IBM Cloud, create cluster free for 30 dayshttps://cloud.ibm.com/registry/startibmcloud login -a cloud.ibm.com -r eu-de -g Defaultibmcloud ks cluster config --cluster cdkg45mf0fj1ue2md1d0kubectl config current-contexthttps://drive.google.com/file/d/1BmMPf2zim1oBbigiyChXKX4KlEAg1gt2/viewhttps://drive.google.com/file/d/1xywLhRlwi6zhy8F-KpPnxHDyUTcIMCuu/view?usp=share_linkdocker built -t br.icr.io/<my_namespace>/<my_repository>:<my_tag> .docker push br.icr.io/<my_namespace>/<my_repository>:<my_tag>https://drive.google.com/file/d/1W_t8NoMHIBJmlXMjb5CZufQzukBs9CM7/view?usp=share_link