Recruitment task for AGH Space Systems. Basic API for communication with the database
Following stuff must be installed to run this app:
- Node.js version 12.8.0 or later
-
Clone or download this repository
git clone https://github.com/Fadikk367/aghss-zad2.git
, -
Go to main directory of cloned repository,
-
Run
npm install
command in your console.
In ".env" file you must assign some stuff to variables:
- DB_CONNECTION = < mongodb connection string here >
Visit mongodb site for help, after logging in to MongoDB Atlas account go to: clusters > connect > connect your application, select version 2.2.12 or later (3.0.0 or later may cause some random authorization problems)
- DB_NAME = < database name >
- COLLECTION_NAME = < collection name >
Finally you can write npm start
in your terminal (in project main folder).
If running locally, don't forget about "localhost:3000" prefix. If running on some hosting then your domain name is your prefix. "/addOne" route is built to handle data from request body.
- /getAll - getting all data from the database,
- /getOne/:id - getting single document with given id,
- /addOne - adding new document to the database,
- /delete/:id - deleting document with given id.
- Node.js - JavaScript runtime built on Chrome's V8 JavaScript engine
- Express.js - Node.js server framework
- MongoDB - general purpose, noSQL, document-based database