Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 1.7 KB

README.md

File metadata and controls

41 lines (36 loc) · 1.7 KB

Subrequests Express Example

An example Express app that uses Subrequests.

Set up MySQL

This app depends on a mysql database.

  1. Create a database named test in your MySQL server.
  2. Import the table structures from tables.sql in the database.
  3. Once the tables are created, then import the sample data from dump.sql.
  4. Edit db.js to add your MySQL username and password replacing the root:root section.

Test the API

Make the following requests to understand the exposed API:

[
  {
    "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"]
  }
]