Quick Credit is an online lending platform that provides short term soft loans to individuals.This helps solve problems of financial inclusion as away to alleviate poverty and empower low income earners.
Within Quick-credit-api folder you WIll find the following directories and files. Cross check in any of the file misses the app may have a problem while bieng excetuted
Quick-credit-api-v1/
│
├── api/
│ ├── models/
│ ├── middleware/
│ └── routes
├── tests/
├── .gitignore/
├── index.mjs
├── package.json
└──README.md
By running the following command quick-credit-api will be automatically downloaded to your local machine so lets get started.
run
npm i quick-credit-api
or
git clone https://github.com/swaibat/quick-credit-ui.git
before you install the software make sure you have the following already installed on your machine
- nodejs get it here
- Nodemon installed globally by runing
npm i nodemon -g
A step by step series of examples that tell you how to get a development env running
- run
npm i
To install all the necessary packages on your local computer
- To start your sever
npm start
this will start your application and run on port 3000
TO run the test for the api
npm run test
So now you can access the following routes using provided methods
- User (client) can sign up
- User (client) can login
- User (client) can request for only one loan at a time
- User (client) can view loan repayment history, to keep track of his/her liability or responsibilities
- User (client) can update profile to meetup requirement after profile rejection
- Admin can mark a client as verified , after confirming his/her home and work address
- Admin can view a specific loan application
- Admin can approve or reject a client’s loan application
- Admin can post loan repayment transaction in favour of a client
- Admin can view all loan applications
- Admin can view all current loans (not fully repaid)
- Admin can view all repaid loans
- V1
- POST /api/v1/auth/signup Create user account
- POST /api/v1/auth/signin Login a user
- GET /api/v1/user Get all user
- GET /api/v1/user/<:id> Get a user
- PATCH /api/v1/user/<:id> Update a user
- DELETE /api/v1/user/<:id> Delete a user
- POST /api/v1/loans Create a loan application
- GET /api/v1/loans/<:loan-id>/repayment View loan repayment history
- GET /api/v1/loans Get all loan applications
- GET /api/v1/loans?status=approved&repaid=false Get all current loans that are not fully repaid
- GET /api/v1/loans?status=approved&repaid=true Get all repaid loans.
- PATCH /api/v1/users/<:user-email>/verify Mark a user as verified
- GET /api/v1/loans/<:loan-id> Get a specific loan application
- PATCH /api/v1/loans/<:loan-id>/approve or reject a loan application
- PATCH /api/v1/loans/<:loan-id>/reject or reject a loan application
- POST /api/v1/loans/<:loan-id>/repayment Create a loan repayment record
https://www.pivotaltracker.com/n/projects/2345046
You can see a hosted version of the template at https://swaibat.github.io/quick-credit-ui-1/
The API is currently in version 1 (v1) and is hosted at https://quick-credit-api.herokuapp.com/
https://quick-credit-api.herokuapp.com/documentation
or you can view the completed tests on server via coveralls
these tests specifically targets the following
- All the http methods to ease api usage and avoid errors in the code.
- all Errors to easily identify error message and course of error.
- Tests for Admin Access to specific routes to avoid other users Access to admin routes.
- check whetther the tokens are posted successfully
- All status codes to make sure all error and success are catered for ``
all test are located in the test folder at the root called test
and Mocha,Chaiand Supertest have been used as testing framework
here is sample code
describe('Test Post Loans', () => {
it('checks if loan posts', (done) => {
request(app)
.post('/api/v1/loans')
.send({ user: 'joelb@gmail.com' })
.set('Accept', 'application/json')
.end((err, res) => {
res.status.should.equal(201);
res.body.should.have.property('status', 'pending');
done();
});
});
});
- Rumbiiha Swaibu - Initial work - swaibat