Module

Bucketchain.SimpleAPI.Batch

Package
purescript-bucketchain-simple-api
Repository
Bucketchain/purescript-bucketchain-simple-api

#BatchParams Source

type BatchParams = Array { body :: Foreign, path :: String }

This is for internal. Do not use it.

#Batch Source

newtype Batch a

The type for enable batch operation.

The batch operation is a mechanism running multiple Proc in one HTTP request.

How to use:

withSimpleAPI appContext $ Batch { firstEndpoint, secondEndpoint }

Request POST /batch with body:

[
  { "path": "/firstEndpoint" },
  { "path": "/secondEndpoint", "body": { "num": 1 } }
]

You will get results like:

[
  {
    "status": 500,
    "body": { "message": "Internal server error" }
  },
  {
    "status": 201,
    "body": { "name": "foo" }
  }
]

Note: POST /batch responds 200 always.

Constructors