Code Monkey home page Code Monkey logo

rent-bike-service's Introduction

User Management

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

Add funds to a user, like users/funds ( post add amount).

POST /users/funds Body: { "token": "jwtToken, "funds": 50 }

Bicycle use

get bicycles list (bicycle id, status, other params ... )

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

return a bicycle (end ride for the user, then calculate ride cost)

POST /bicycles/{bikeId}/rent-end

report a broken bicycle (i.e bicycles/55/broken)

POST /bicycles/{bikeId}/broken

turn light on all bicycles

POST /bicycles/turn-light

add bicycle/bicycle emulator

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 current bicycle status

GET /bicycles/{bikeId}

Project Requirements

  • Node.js
  • mongodb

Mongodb collections:

  • users
  • bicycles
  • rides

Data-flow diagram

Diagram

How to run the project?

  1. Add setting to config.js
  2. node app.js or if you have nodemon npm run start
  3. Run as many bicycle emulators as you want (but on different ports) node bike.js objectBikeId PORT

rent-bike-service's People

Contributors

misterioss avatar

Watchers

James Cloos avatar Alex Pletnov avatar Serhii Hornostaiev avatar  avatar Max Savonin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.