User authentication - generate a token that will be used for further actions in the system. i.e send a request like
POST /users/join
returns JWT token. You need to provide it to further requests
POST /users/funds
Body: { "token": "jwtToken, "funds": 50 }
GET /bicycles
rent a bicycle by ID ( renting will cost 5$ per hour, only for bicycles that are not currently rent and not broken)
POST /bicycles/{bikeId}/rent
POST /bicycles/{bikeId}/rent-end
POST /bicycles/{bikeId}/broken
POST /bicycles/turn-light
node bike.js objectBikeId PORT
A bicycle will automatically be added to database
Bicycle emulator sends its status every 1 minute, in case of managament application couldn't connect to a bike it assumes the bike broken and nobody can use it.
GET /bicycles/{bikeId}
- Node.js
- mongodb
- users
- bicycles
- rides
- Add setting to config.js
node app.js
or if you have nodemonnpm run start
- Run as many bicycle emulators as you want (but on different ports)
node bike.js objectBikeId PORT