A simple server application, that can be used for registering students and companies for a placement event in an institute.
API documentation: https://gauravano.github.io/placement-drive-backend/apidoc/index.html
API server hosted at Glitch: https://gauravano-placement-drive-backend.glitch.me/api/
- In the console, download a copy of the repo by running
git clone https://github.com/gauravano/placement-drive-backend
. - Enter the placement-drive-backend directory with
cd placement-drive-backend
. - Run
npm install
to install the node dependencies mentioned in the package.json. - Run
npm start
for running the development server. Navigate tohttp://localhost:4000/
. - The database is hosted at Mongo Lab, so you need to create a free sandbox at https://mlab.com/ and then copy the URI from there and save it as
MONGO_URI: <URI from your sandbox without quotes>
in .env file.
Run npm start
for a running development server. Navigate to http://localhost:4000/
.
The API documentation is generated using https://api-docs.io/ by using npm package.
The documentation give details about all the endpoints, parameters, and also provide option to make sample requests from there only. So, head over to https://gauravano.github.io/placement-drive-backend/apidoc/index.html and do the testing 😄
Logging in the application is done using 2 modules winston and morgan. The logic for setting the logger is at https://github.com/gauravano/placement-drive-backend/blob/master/logger.js. And, both loggers are combined at https://github.com/gauravano/placement-drive-backend/blob/master/app.js#L7-L10
Schema validation is used while creating the schema using Mongoose only, see https://mongoosejs.com/docs/validation.html for details.
Another npm package Express-validator is used for performing validation of API, sanitization, error handling, etc.