WayFarer is a public bus transportation booking server. Users can view a list of trips and make bookings.
Click here to view the app on heroku.
The app has three levels of authorization;
-
A client can
- view public documents on the website
- signup for an account to use the service
-
A normal user can:
- view the list of available trips
- search trips by origin or destination
- make bookings
- view all bookings made by them
- delete their bookings
- signin into their accounts.
-
An admin user has all the privileges of a regular user but the admin can also perform the following actions:
- view all users.
- post(create) buses that can be used for the trips
- the admin can also view, update and remove a bus
- create trips that users can book from
- cancel a trip
The application was developed with NodeJs, Express was used for routing and Postgres for database management.
Follow the steps below to setup a local development environment. First ensure you have Postgresql installed, and a version of Node.js equal or greater than v6.10.0 .
- Clone the repository from a terminal
https://github.com/codecell/wayfarer.git
. - Navigate to the project directory
cd wayfarer
- Rename
.env_sample
to.env
and add the required DATABASE settings(DB_PROD, ...). - Install project dependencies
npm install
- Start the express server
npm run start:dev
if in development.
Ensure that project dependencies are installed before running tests.
- Open a terminal and navigate to the project directory
- Add a test database url (DB_TEST) to the
.env
file. - Run
npm run test
View full API documentation here
EndPoint | Functionality |
---|---|
POST api/v1/auth/signup | Allows a client to create an account. |
POST api/v1/auth/signin | signs in a user. |
EndPoint | Functionality |
---|---|
GET api/v1/users | Allows an admin to view all users. |
GET api/v1/users/:userId | Allows an admin to view a specific user. |
EndPoint | Functionality |
---|---|
POST api/v1/buses | Allows an admin to post a bus. |
GET api/v1/buses | Allows an admin to view all buses. |
GET api/v1/buses/:busId | Allows an admin to view a specific bus. |
PATCH api/v1/buses/:busId | Allows an admin to update a specific bus. |
DELETE api/v1/buses/:busId | Allows an admin to delete a specific bus |
EndPoint | Functionality |
---|---|
POST api/v1/trips | Allows an admin to create a trip. |
GET api/v1/trips | Allows users to view all trips. |
GET api/v1/trips/:tripId | Allows an admin to view a specific trip. |
GET search/trips?q=${query} | Allows users get trips from the same origin or the ones headed for same destination. |
PATCH api/v1/trips/:tripId | Allows an admin to cancel a specific trip. |
DELETE api/v1/trips/:tripId | Allows an admin to delete a specific trip |
EndPoint | Functionality |
---|---|
POST api/v1/bookings | Allows user to make a booking. |
GET api/v1/bookings | Allows an admin to view all bookings & allows a user to view all of his/her bookings only. |
DELETE api/v1/bookings/:bookingId | Allows user to delete their bookings only. |
Currently, this app can only handle server side requests, but i hope to make its user interface soon.
Contributions are most welcome. Simply fork the repository, work on the feature and raise a PR.
MIT