This is the backend application for DevPlaces, a small project inspired in Rocketseat OmniStack Week 9
- Clone the project
git clone https://github.com/rafaelcalhau/devplaces-backend.git
- Navigate into the project folder
cd devplaces-backend
- Install all dependencies using the NPM or YARN
npm install # or yarn
- Rename the file .env.example to .env and edit it with your own data.
cp .env.example .env
🚨 NOTICE: before running the project, make sure your .env file is already created and have all necessary values. This application uses MongoDB, and if you don't want to run it on your local environment, you can create your database totally free on MongoDB Atlas.
Run for development:
npm run dev # or yarn dev
-
Sign In:
POST /api/authenticate
{ "email": "string", "password": "string" }
-
Create User
POST /api/users
body:
{ "name": "string", "email": "string", "password": "string" }
Required: Add your user id into the request headers
{
"userid": "string"
}
-
Create a spot
POST /spots
body:
{ "company": "string", "price": 15.0, "technologies": "php,javascript,react" }
Accepts an file upload.
-
Update a spot
PUT /spots/:id
body:
{ "company": "string", "price": 15.0, "technologies": "php,javascript,react" }
Accepts an file upload.
-
Delete a spot
DELETE /spots/:id
-
List all spots
GET /spots
-
Book a spot
POST /spots/:spot_id/bookings
body:
{ "date": "string" }
-
Update a booking
PATCH /spots/:spot_id/bookings/:booking_id
body:
{ "approved": "boolean" }
-
Delete a booking
DELETE /spots/:spot_id/bookings/:booking_id
-
List all bookings from a spot
GET /spots/:spot_id/bookings