- EXPRESS (4.16.4)
- CORS (2.8.5)
- MongoDB (3.1.13)
- SWAGGER-JSDOC (3.5.0)
- SWAGGER-UI-EXPRESS(4.1.3)
- HELMET (3.15.0)
- BODY-PARSER (1.18.3)
Clone this repository [git clone https://github.com/Reebby/nanosbackend.git]
In the project directory, you can run:
To Install dependencies needed to run this project.
This Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits due to the use of nodemon (https://www.npmjs.com/package/nodemon) .
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
For our test we make use of the jest and supertest librabry.See the section about running tests with jest for more information.
This project can be run in a container using docker.
NOTE: You must have docker-compose installed (https://docs.docker.com/compose/install/)
In the project directory, you can run:
To Install dependencies needed to run this project and runs the app in the development mode.
Open http://localhost:3000 to view it in the browser..
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits due to the use of nodemon (https://www.npmjs.com/package/nodemon) .
You will also see any lint errors in the console.
You can access the api endpoint documentation here (http://68.183.59.209:3000/api-docs/).
This was created using the swagger-ui-express package (https://www.npmjs.com/package/swagger-ui-express)
and swagger-jsdoc (https://www.npmjs.com/package/swagger-jsdoc)
To run this project locally on your computer, you'll need to create a mongodb atlas account
and a cluster/database. This blog explains how to do so in details (https://codeforgeek.com/mongodb-atlas-node-js/).
Take note of the connection string you get after setting up your mongodb account
e.g mongodb+srv://USERNAME:PASSWORD@cluster0-1q7ty.mongodb.net/DBNAME
Now you'll need to upload the json files in our local data folder to the mongodb database that you have created.
You can do this by following these steps and commands:
-- cd into the project directory and into the data folder via your terminal and run these commands:
-
mongoimport --db dbName --collection data_adgroups --file data_adgroups.json --jsonArray
-
mongoimport --db dbName --collection data_ads --file data_ads.json --jsonArray
-
mongoimport --db dbName --collection data_campaigns --file data_campaigns.json --jsonArray
-
mongoimport --db dbName --collection data_stats --file data_stats.json --jsonArray
Create a .env file and set:
MONGODB_URI = mongodb+srv://USERNAME:PASSWORD@cluster0-1q7ty.mongodb.net/DBNAME
MONGODB_DATABASE = DBNAME
to have access to the database in this project.
CircleCI (https://circleci.com/) is used for CICD [continous integration and continous deployment] in this project.