The Booking API uses a Mongo database. If you are running the application locally, you will need to have a MongoDB running and will have to run the application in production mode.
If you don't run the application in production mode, the API will use memory storage instead of your MongoDB, and your data will be erased on any restart to the server.
Install and run MongoDB.
Fork the Booking API repo, clone it to your machine and run npm install.
npm install
Start the application.
NODE_ENV=production npm start
Navigate to the API explorer where you can post some data.
http://localhost:3000/explorer/
- Click on a resource, eg: Location.
- Click post.
- Enter some data in the same format as the example, and hit the 'try it out' button. ID's are automatically generated.
{
"name": "Discovery One"
}
See below to see the relationships of the models.
Booking
belongs_to
Room
Feature
belongs_to
Room
Location
has_many
Rooms
Room
belongs_to
Location
Roomhas_many
Bookings
Roomhas_many
Features
MONGODB_URI
- URI for your production database.
PORT
- Determines port, defaults to 3000.