WeConnect provides a platform that brings businesses and individuals together. This platform creates awareness for businesses and gives the users the ability to write reviews about the businesses they have interacted with.
To set up WeConnect API, make sure that you have python 3.6 or more, postman and pip installed.
- Clone the Repo into your local directory.
$ git clone https://github.com/cosmas28/business-connect-v2.git
- create a virtual environment.
$ virtualenv <your_virtualenv>
- Activate your virtual environment
Navigate to the API directory.
$ cd business-connect-v2
To install the packages run pip install -r requirements.txt
- Install PostgreSQL.
- Create a new database.
- Change Database configuration at
SQLALCHEMY_DATABASE_URI
environment variable to include your database name, password and user name i.eSQLALCHEMY_DATABASE_URI = 'postgresql://<username>:<password>@localhost/database_name'
- Run migrations initialization using this command
$ python manage.py db init
- Run actual migrations using
$ python manage.py db migrate
- Finally apply migrations using
$ python manage.py db upgrade
- Then each time the database models change repeat the migrate and upgrade commands.
$ python manage.py runserver
- Run the server
$ python manage.py runserver
- Browse http://localhost:5000/apidocs/
Run the endpoints on Postman
Run the test using bash
$ pytest
Run the API endpoints using the following URLs
HTTP Method | URL | Functionality |
---|---|---|
POST | /api/v2/auth/register | Creates a new user account |
POST | /api/v2/auth/login | logs in a user |
POST | /api/v2/auth/logout | logs in a user |
POST | /api/v2/auth/reset-password | Password Reset |
POST | /api/v2/businesses | Registers a business |
GET | /api/v2/businesses | Retrieves all businesses |
GET | /api/v2/businesses/int:business_id | get a business |
DELETE | /api/v2/businesses/int:business_id | Remove a business |
PUT | /api/v2/businesses/int:business_id | Update a business profile |
POST | /api/v2/businesses/int:business_id/reviews | Add a review for a business |
GET | /api/v2/businesses/int:business_id/reviews | Get all reviews for a business |
GET | /api/v2/businesses/location?q=&start=&limit= | Filter businesses based on location |
GET | /api/v2/businesses/location?q=&start=&limit= | Filter businesses based on category |
GET | /api/v2/businesses/search?q=<business_name>&start=&limit= | Search for a business |
- Andela Kenya Recruitment team for inspiration