REST Services - MorenaBarboni/Pick-A-Park GitHub Wiki
The pick a park project comes with built in REST API that offer a simple interface to the different types of users and devices.
The following sequence diagram represent a high-level request and response data flow of our MEAN stack application. The client-side consists of the web application AngularJs client. However, this can be replaced by the mobile Android client or the parking spot device. In that case, the client would directly send RESTful API requests to the NodeJs server.
The next sequence diagram represents a request and response flow for a specific request.
A parking company employee accesses the management web page, and the controller initializes itself, triggering a function to retrieve all the parking spots managed by the company. Then the controller calls the service function parkingComp.getParkings(user.company)
. Services expose functionalities to the controllers and increase modularity and reusability in our application. When the function is called, the corresponding RESTful api request is triggered. The NodeJs server handles the API request and response. The server handles these requests in an asynchronous and non-blocking way. When the query data has been retrieved, the callback function is invoked and the json response is returned to the client.
- POST /driver-login - Driver login
- POST /driver - Driver registration
- GET /users - Retrieve web app user data
- POST /login - Web app user login
- POST /users - Web app user registration
- GET /companies - Retrieve all companies data
- GET /companies:name - Retrieve specific company data
- POST /companies - Create a new company
- DELETE /companies - Delete a company
- GET /companies/:name/parkings - Retrieve all the parking spots of a parking company
- GET /companies/:name/parkings/:id - Retrieve a specific parking spot of a parking company
- POST /companies/:name/parkings - Create a new parking spot
- DELETE /companies/:name/parkings/:id - Delete a parking spot
- PATCH /companies/:name/parkings/:id - Update properties of a parking spot
- POST /companies/:name/bookings - Create a new booking for a parking spot
- GET /stops - Retrieve all the stops
- PATCH /stops/:id - Update properties of a stop
- POST /stops/start - Simulate driver arrival
- PATCH /stops/end - Simulate driver departure
- GET /destination - Retrieve a parking according to the driver's destination
- POST /notices - Creates a new notice