An example Express app that uses Subrequests.
This app depends on a mysql database.
- Create a database named
test
in your MySQL server. - Import the table structures from
tables.sql
in the database. - Once the tables are created, then import the sample data from
dump.sql
. - Edit
db.js
to add your MySQL username and password replacing theroot:root
section.
Make the following requests to understand the exposed API:
[GET]
http://localhost:3002/customer[GET]
http://localhost:3002/user[POST]
http://localhost:3002/subrequests with body
[
{
"requestId": "customers",
"action": "view",
"uri": "/customer"
},
{
"requestId": "users",
"action": "view",
"uri": "/user/{{customers.body@$.*.User_id}}",
"waitFor": ["customers"]
},
{
"requestId": "githubs",
"action": "view",
"uri": "https://api.github.com/users/{{users.body@$.*.Github_handle}}",
"headers": { "User-Agent": "Subrequests" },
"waitFor": ["users"]
}
]