This is a proof of concept (POC) project for a mock server using Express.js. The server provides endpoints for user data and credit check simulations.
data/
: Contains JSON files for user data and credit check responses.routes/
: Contains route handlers for user and credit check endpoints.server.js
: The main entry point of the application.
- Clone the repository.
- Run
npm install
to install the dependencies.
You can start the server using the following npm scripts:
npm start
: Starts the server in the default environment.npm run start:dev
: Starts the server in the development environment.npm run start:staging
: Starts the server in the staging environment.npm run start:prod
: Starts the server in the production environment.
GET /user/:userId
: Fetches the data for a user with the given ID.POST /credit-check
: Simulates a credit check for the user data provided in the request body.
To test the server, you can use any HTTP client like curl or Postman. Here are some example requests:
- Fetch user data:
curl http://localhost:3000/user/1
- Perform a credit check:
curl -X POST -H "Content-Type: application/json" -d '{"email": "[email protected]"}' http://localhost:3000/credit-check
- Appending +highRisk or +lowRisk to the credit check POST body email like this
{"email": "[email protected]"}
will return low or high risk data (Credit score, risk index, etc.)