pied-piper v0.0.1

config

Runtime configuration for the admin client.


/api/config

GET

Returns a runtime config object.

{
  "preFlight": {
    "env": "development",
    "port": 3100,
    "target": "https://jsonplaceholder.typicode.com"
  },
  "fakes": [
    "example"
  ],
  "strict": false,
  "recording": true,
  "active": true,
  "dump": true,
  "sleep": 0,
  "retryLockTimeout": 0,
  "disabledProjects": [ "project-foo" ]
}

PUT

Modify runtime config.

body schema


/api/config/toggle-project/:project

params schema

PUT

Toggle project. Accepts empty payload.
Returns empty body on success.

projects

Projects are containers. You can create "projectfoo" by calling
pied piper proxy through http://pied-piper.dev:3100/project-foo/proxy.

Project names may contain alphanumeric characters and underscores only.


/api/projects

GET

Returns a list of project names.

response

["foo", "bar", "baz"]

/api/projects/:project

params schema

DELETE

Delete project by name, destroy collection in database.
Returns empty body on success.

proxied resources

Proxied resources are the responses recorded in the db.
They may be retrieved, modified or deleted.


/api/proxied-resources/:project

params schema

GET

Get a list of resources. Response is an array of proxied resource objects.

DELETE

Flush all items. Returns empty body on success.


/api/sse/proxied-resources/:project

Server side events (SSE). Streaming endpoint.

GET

Gets a new proxied resource object.


/api/proxied-resource/:project/:id

GET

Disabled and sleep are optional, _id is mongo id.

{
  "_id": "5895c2d67334cc413176f0ec",
  "disabled": true,
  "sleep": 3,
  "lastModified": "2017-02-04T12:02:30.687Z",
  "request": {
    "body": { /*...*/ },
    "headers": { /*...*/ },
    "method": "GET",
    "target": "/posts",
    "uri": "https://jsonplaceholder.typicode.com/posts"  
  },
  "response": {
    "headers": { /*...*/ },
    "statusCode": 200,
    "body": { /*...*/ }
  }
}

PUT

Modify a stored resource object. Returns empty body on success.

body schema

DELETE

Deletes resource from db. Returns empty body on success.


/api/proxied-resource/toggle/:project/:id

params schema

PUT

Returns empty body on success.

proxy

The purpose of the project, transparently proxy calls from
remote endpoint to local client.


/:project/proxy/*

The main proxy api endpoint. Anything directed here will be
proxied transparently forward to the env.TARGET url.

GET, POST, PUT, PATCH, DELETE

params schema

response

Remote payload.