WayFarer is a public bus transportation booking server.
This is an api backend for public bus transportation booking. It is created to give free and open access to the public to have a good and well managed transport system. The backend server is persist with a postgreSQL database. The endpoints are to be secured with JSON Web Token (JWT).
Here's are the available features:
- User can sign up.
- User can sign in.
- Admin can create a trip.
- Both Admin and Users can see all trips.
- Users can book a seat on a trip.
- View all bookings. An Admin can see all bookings, while user can see all of his/her bookings.
- Users can delete their booking.
- Admin can cancel a trip.
- User can get and filter trips using trip destination.
- User can get and filter trips using trip origin.
- User can change seats after booking.
The API endpoints respond with a JSON object specifying the HTTP status code, and either a data property (on success) or an error property (on failure). When present, the data property is always an object or an array .
A list of commonly used resources that I find helpful are listed in the acknowledgements.
listed below are major frameworks that i used to build the project. Add-ons/plugins are in the acknowledgements section.
To get a local copy up and running follow these simple example steps.
You will need to install some necessary tools before you can use this project.
- npm
npm install npm@latest -g
- postgresql
https://www.postgresql.org/download
- If you dont want local databse, you can get a free plan postgresql server at https://elephantsql.com
- Clone the repo
git clone https://github.com/dinorhythms/WayFarer.git
- Install NPM packages
npm install
- create .env in the root folder then add DB_URL & TOKEN_SECRET
.env
DB_URL = 'ENTER YOUR DB CONNECT STRING FROM ELEPHANTSQL.COM';
TOKEN_SECRET = 'ENTER YOUR SECRET FOR JWT TOKEN';
npm run test
| HTTP VERB | ENDPOINT | FUNCTIONALITY |
|---|---|---|
| POST | /api/v1/auth/signup | User can signup |
| POST | /api/v1/auth/login | User can signin |
| POST | /api/v1/trips | Admin can create a trip |
| POST | /api/v1/bookings | Users can book a seat on a trip |
| GET | /api/v1/trips | Users and Admin can view all trips |
| GET | /api/v1/trips/destination/NAME_OF_DESTINATION | Users can view trips by destination |
| GET | /api/v1/trips/origin/NAME_OF_ORIGIN | Users can view trips by origin |
| GET | /api/v1/bookings | Admin can view all bookings, Users can view their own bookings |
| PATCH | /api/v1/trips/:tripId | Admin can cancel a trip |
| DELETE | /api/v1/bookings/:bookingId | Users can delete a booking |
- Signup
POST https://dinorhythms-wayfarer.herokuapp.com/api/v1/auth/signup
- Signin
POST https://dinorhythms-wayfarer.herokuapp.com/api/v1/auth/signin
For more examples, please refer to the Documentation
See the open issues for a list of proposed features (and known issues).
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please make sure to update tests as appropriate.
Distributed under the MIT License. See LICENSE for more information.
Oladehinde Kazeem - @dinorhythms - larrysnet2001@gmail.com.com
Project Link: https://github.com/dinorhythms/WayFarer