Technology moves fast! ⚡ Don't get left behind.🚶 Subscribe to our mailing list to keep up with latest and greatest in open source projects! 🏆

Subscribe to our mailing list


Batch request plugin for hapi

Subscribe to updates I use bassmaster

Statistics on bassmaster

Number of watchers on Github 122
Number of open issues 1
Average time to close an issue 3 months
Main language JavaScript
Average time to merge a PR 20 days
Open pull requests 1+
Closed pull requests 2+
Last commit over 1 year ago
Repo Created over 6 years ago
Repo Last Updated over 1 year ago
Size 215 KB
Organization / Authorhapijs
Latest Releasev3.1.1
Page Updated
Do you use bassmaster? Leave a review!
View bassmaster activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating bassmaster for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

bassmaster Logo

Bassmaster makes it easy to combine requests into a single one. It also supports pipelining, allowing you to take the result of one query in the batch request and use it in a subsequent one. The batch endpoint only responds to POST requests.

Build Status


Lead Maintainer: Christopher De Cairos

Getting Started

Install bassmaster by either running npm install bassmaster in your sites working directory or add 'bassmaster' to the dependencies section of the 'package.json' file and run npm install.

Available options

At this time the options object supports the following configuration:

  • batchEndpoint - the path where batch requests will be served from. Default is '/batch'.
  • description - route description used for generating documentation. Default is 'Batch endpoint'
  • notes - route notes used for generating documentation. Default is 'A batch endpoint which makes it easy to combine multiple requests to other endpoints in a single call.'
  • tags - route tags used for generating documentation. Default is ['bassmaster']
  • auth - If you need the batch route to have authentication

As an example to help explain the use of the endpoint, assume that the server has a route at '/currentuser' and '/users/{id}/profile/'. You can make a POST request to the batch endpoint with the following body and it will return an array with the current user and their profile. Pipelining uses Hoek.reach to retrieve values from request results.

{ "requests": [
    {"method": "get", "path": "/currentuser"},
    {"method": "get", "path": "/users/$"}
] }

The response body to the batch endpoint is an ordered array of the response to each request. Therefore, if you make a request to the batch endpoint that looks like

{ "requests": [
    {"method": "get", "path": "/users/1"},
    {"method": "get", "path": "/users/2"}
] }

The response will look like the following, where the first item in the response array is the result of the request from the first item in the request array.

[{"userId": "1", "username": "bob"}, {"userId": "2", "username": "billy" }]

When making a POST request as part of the batch assign the 'payload' property with the contents of the payload to send.

Optionally you can assign the query as a third property rather than placing it directly into the path. The query property accepts an object that will be formatted into a querystring.

{ "requests": [
    { "method": "get", "path": "/users/1", "query": { "id": "23", "user": "John" } }
] }

If an error occurs as a result of one the requests to an endpoint it will be included in the response in the same location in the array as the request causing the issue. The error object will include an error property that you can interrogate. At this time the response is a 200 even when a request in the batch returns a different code.

bassmaster open issues Ask a question     (View All Issues)
  • almost 3 years Feature request: Add name/label to batches
bassmaster open pull requests (View All Pulls)
  • Reference value illegal characters check is too restrictive
bassmaster list of languages used
bassmaster latest release notes
  • Modified the regular expression that checks values being used in subsequent batched request URLs so that it doesn't use backtracking #83

3.0.1 Release Notes

Updated a validation regex to add support for Id's which contain dashes (like uuid's) and dots (like file names). (Thanks @profpylons!)

Other projects in JavaScript