Bootstrap for a CRUD backend system targeted at persisting mobile apps metrics.
The REST API backend has been developed using Node JS 12 LTS using MS SQL as default database (to comply with most of the corporates requirements).
You can change the SQL configuration in api/app/config/db.config.js.
-
Make sure you have Node installed
-
Install DB engines:
- MS SQL: install SQL Server using Docker on Unix: https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-2017&pivots=cs1-bash and Azure Data Studio to connect directly to the database
- SQLite: no actions needed (Mac OS)
-
Create a
.envfile in theapifolder with the local database settings:- MS SQL:
DB_HOST=localhost DB_USER=sa DB_PASS=YourStrong@Passw0rd1 DB_PORT=1401 DB_DIALECT=mssql PORT=3000
- SQLite:
DB_HOST=localhost DB_USER=root DB_PASS=root DB_PORT=1401 DB_STORAGE=mobile_metrics.sqlite DB_DIALECT=sqlite PORT=3000
-
Install the dependencies by running
./yarn install; for true offline installations, please update the.gitignorefile to persist the downloaded binaries -
Run the server locally with
npm run debugTo kill existing open instances of the server do:
sudo lsof -i :3000 kill -9 <PID>
The project is structured to be easily debugged using VS Code with a preconfigured launch command
-
Add a new
Userentry to theuserstable in the database with thetokenthat will be matched against theX-API-Tokenvalue of the API requests -
Test the APIs using this Postman collection:
In order to update dependencies, please make sure check your Yarn offline configuration.