Skip to content

dinorhythms/WayFarer

Repository files navigation

WayFarer API

WayFarer is a public bus transportation booking server.

Build Status Coverage Status Maintainability Test Coverage

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).

Documentation_

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.

Built With

listed below are major frameworks that i used to build the project. Add-ons/plugins are in the acknowledgements section.

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

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

Installation

  1. If you dont want local databse, you can get a free plan postgresql server at https://elephantsql.com
  2. Clone the repo
git clone https://github.com/dinorhythms/WayFarer.git
  1. Install NPM packages
npm install
  1. 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';

Run Test

npm run test

API End Points Test Using Postman

HTTP VERBENDPOINTFUNCTIONALITY
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

Usage

  • 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

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please make sure to update tests as appropriate.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Oladehinde Kazeem - @dinorhythms - larrysnet2001@gmail.com.com

Project Link: https://github.com/dinorhythms/WayFarer

Acknowledgements

About

WayFarer API - WayFarer is a public bus transportation booking server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors