PlacesApp-API is a REST API built with Node.js, Express.js, and MongoDB, featuring various functionalities, including user authentication, CRUD operations and Geocoding.
This is the backend for PlacesApp-Frontend.
The API provides the following endpoints:
- User signup:
POST /api/v1/users/signup
(public) - User login:
POST /api/v1/users/login
(public) - User logout:
GET /api/v1/users/logout
(public) - Get all users:
GET /api/v1/users
(public)
- Get all places:
GET /api/v1/places
(public) - Get all places by userid:
GET /api/v1/places/user/:uid
(public) - Get single place by id:
GET /api/v1/places/:id
(public) - Create place:
POST /api/v1/places
(private - user) - Update place:
PATCH /api/v1/places/:id
(private - user) - Delete place:
DELETE /api/v1/places/:id
(private - user)
Please check PlacesApp API Documentation for more information.
This project utilizes various middleware for tasks such as error handling, geocoding, etc. :
utils/appError.js
: for handling errors and sending appropriate responsesutils/catchAsync.js
: for handling async/await functions in Express routesutils/geogode.js
: for converting addresses to coordinates using Mapbox API
You need to create an .env
file for the application to work. There is a sample.env
file that contains all configuration examples.
This projects includes a dev-data
folder that contains json files with the development data for the application and can be imported into the database using import-dev-data.js
script.
All passwords in users.json
are randomly generated and encrypted, so don't forget to change this before importing.
node dev-data/import-dev-data.js --import
Script also provides a way to delete the data from the database:
node dev-data/import-dev-data.js --delete
Have a bug or an issue with this template? Open a new issue here on GitHub.
This code is released under the GPL-3.0 license, which means you have the four freedoms to run, study, share, and modify the software. Any derivative work must be distributed under the same or equivalent license terms.