Traveloka-Proxy
What
A (fun) project that creates a dumb node.js server that will give response based on certain set of rules.
Why
Aimed to help FE engineers & QE to cut dependency with BE. Although BE already have mock mechanism, it has several pain points such as, but not limited to:
- It's not very flexible. The granularity level is not on the field level, but in one full response level. That means you can't change only one particular field in one mock state, but you need to change the whole response to another mock state.
- You need a working staging (VPC) machine in order to use the mock.
- If we are working with another team API (e.g. myBooking / standardize booking form) it's not guaranteed that we can expect mock from those APIs.
How to use:
- Install Node.js & npm (http://blog.teamtreehouse.com/install-node-js-npm-mac). Web engineer should already have this installed, don't need links lah ;)
- Clone the project
- Duplicate
.env.example
to .env
- Run
npm i -g @adonisjs/cli
- Run
npm install
- Run
adonis serve --dev
Client
- Add new staging
- For android, input
10.0.0.2:3333
as the addresses (all of them)
- TODO for iOS
- TODO for web
Rules creation
Open app/Rules/rules.json
and add your rules there. You can take a look on what kind of rules are possible (or at least will be possible in the future) by referencing to the rules.definition.json
Caveat:
- It's not intended to replace the current mock system, it's only to unblock FE engineers to move forward if there's any blocker exist in the staging machine.
- You still need to agree first with your BE engineers on the API contract (Request & Response) before using this tools effectively.
TODO
Any contribution is very welcomed!
:joy:
There's lots of things need to be done, but some of the key features that none there yet is:
- Ability to define rules and files for each use -> Currently the rules and files are pushed to the repository
- Ability to see logs of requests & responses in a UI view. -> This helps QE verify the request & response getting through.
- Ability to make response based on logic upon request
- Move this project using express.js (?)
- Better documentation :)))