Rest API for LarnU Full-stack Bootcamp's final project for our graduation.
DEVS PORTAL is a web app where graduated LarnU students can be contacted and show their skills to recruiters and future employers.
IMPORTANT:
git clone <this_repo_url>
npm i && sudo npm install -g firebase-tools && sudo apt install default-jdk
npm run db:up # resets db & runs migrations & seeders
# generates google application credential file for Firebase login
node ./src/services/firebase/genGoogleCrendentials.js
# export our private_key
export GOOGLE_APPLICATION_CREDENTIALS=~/larnU_bootcamp/devs_portal_backend/src/services/firebase/larnu-devs-portal-2ba51ded54fa.json
# CHECKING
echo $GOOGLE_APPLICATION_CREDENTIALS
# Run firebase Emulators
firebase emulators:start
npm run dev:start
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
How to set the environment from scratch.
npm init --y
Then we install all dependecies and devDependencies with npm i [dependencies] & npm i --save-dev [devDependencies]
npx tsc --init
npx ts-jest config:init
npm init @eslint/config
npm run db:up
npm run db:create
npm run db:drop
npm run db:seed
npm run typeorm migration:generate ./src/migrations/<migration_name>
npm run typeorm migration:run # runs all migrations
npm run typeorm migration:revert # reverts all migrations
npm run typeorm -d <your-data-source-path> migration:{run|revert} # runs or reverts migration by file
Install thunder-client vscode extension to save the collections into our workspace.
ctrl + shift + p
Open Preferences: User Settings (JSON) vscode command palette and insert into settings.json:
{ "thunder-client.saveToWorkspace": true }
Then you can visualise the folder thunder-tests to test the endpoints and save any change or test.
In order to install firebase-cli and login without opening a browser window and use CI/CD workflow
Now go to the following link:
https://firebase.google.com/docs/app-distribution/authenticate-service-account?platform=ios
# INSTALLATION
sudo npm install -g firebase-tools
# AUTHENTICATION
export GOOGLE_APPLICATION_CREDENTIALS=~/larnU_bootcamp/devs_portal_backend/src/services/firebase/larnu-devs-portal-2ba51ded54fa.json
echo $GOOGLE_APPLICATION_CREDENTIALS
$ /home/cesar/larnU_bootcamp/devs_portal_backend/src/services/firebase/larnu-devs-portal-2ba51ded54fa.json
sudo apt update
sudo apt install default-jdk
firebase --version
firebase --help # list all commands
firebase init
or
firebase init emulators # firestore, hosting, etc...
firebase emulators:start --only storage # firestore, hosting, etc...
# FOR CI/CD WORKFLOWS
firebase emulators:exec <scriptCommand> # "npm run test:start", etc...