Hi! This is an API where it's possible to list users and policies from data in data
folder.
It has authentication and authorization - admin
role is needed to filter users by policy and list policies.
The API is deployed on Heroku here.
POST /login
GET /users?id={id}&name={name}&policy={policy}
GET /policies?username={username}
- To login, make a
POST
tohttps://insurance-api-test.herokuapp.com/login
with the following body:{ "email": "[email protected]" }
- Get the
token
and use it in the subsequent requests: headerAuthorization: Bearer {token}
- To get a user by id, make a
GET
tohttps://insurance-api-test.herokuapp.com/users?id=a0ece5db-cd14-4f21-812f-966633e7be86
- To get a user by name, make a
GET
tohttps://insurance-api-test.herokuapp.com/users?name=Britney
- To get the list of policies linked to a user name, make a
GET
tohttps://insurance-api-test.herokuapp.com/policies?username=Britney
. Only allowed foradmin
users. - To get the user linked to a policy number, make a
GET
tohttps://insurance-api-test.herokuapp.com/users?policy=64cceef9-3a01-49ae-a23b-3761b604800b
. Only allowed foradmin
users.
- This project uses Node 11.7 with native ES Modules
- Routes are defined in Express and authentication is handled by
jsonwebtoken
- Folders are organized around features instead of roles
- App automatically deployed to Heroku on each push to master
npm install
andnpm start
will run the application with nodemon for live reloadsnpm test
runs tests