SoftOverflow backend API. GitHub Repo.
# Install dependencies
npm i
# Install dev-dependencies
npm i -D nodemon
# Serve on localhost:7000 (development)
npm run dev
# Serve on localhost:7000 (production)
npm start
# Import sample data into mongodb
node seeder -i
# Delete data from mongodb
node seeder -d
Note |
---|
URL https://softoverflow.herokuapp.com |
URL https://softoverflow.glitch.me |
Routes | Description |
---|---|
Authentication | |
POST url/api/v1/auth/register | Register a User |
POST url/api/v1/auth/login | Login User |
GET url/api/v1/auth/me | Get Logged in User |
GET url/api/v1/auth/logout | Logout User |
Questions | |
POST url/api/v1/questions | Ask Question |
GET url/api/v1/questions | Get All Questions |
GET url/api/v1/questions/:id | Get Single Question |
Answers | |
POST url/api/v1/questions/:questionId/answers | Answer Question |
GET url/api/v1/answers | Get All Answers |
GET url/api/v1/questions/:questionId/answers | Get Answers For Question |
GET url/api/v1/answers/:id | Get Single Answer |
Ratings | |
POST url/api/v1/questions/:questionId/ratings | Add Rating For Question |
GET url/api/v1/ratings | Get All Ratings |
GET url/api/v1/questions/:questionId/ratings | Get Rating For Question |
GET url/api/v1/ratings/:id | Get Single Rating |
Users | |
GET url/api/v1/users | Get All Users |
GET url/api/v1/users/:id | Get Single User |
Advanced Filtering | |
Questions | |
GET url/api/v1/questions?categories[in]=Java | Search Questions by category |
Answers | |
GET url/api/v1/answers?isSolution=true | Search Answers by isSolution |
Users | |
GET url/api/v1/users?role=user | Search Users by role |
Select, Sorting | |
GET url/api/v1/questions?select=question,averageRating | |
GET url/api/v1/ratings?sort=createdAt | Sort Rating, Ascending |
Pagination | |
GET url/api/v1/questions?page=2&limit=2 | |
GET url/api/v1/questions?select=question&page=1 | |
GET url/api/v1/questions?page=2 |