@spikedpunch/forge-plugin-rest

0.1.1 • Public • Published

forge-plugin-rest

An HTTP REST for forge. This plugin uses the got.

References:

Installation

npm install @spikedpunch/forge-plugin-rest

Usage

module.exports = {
   pipelines: {
      plugins: [
         { 
            name: 'rest', plugin: new RestPlugin({url: 'https://api.openbrewerydb.org'})
         },
      ],
      rest: {
         steps: [
            {
               // Read
               alias: 'get-breweries',
               plugin: 'rest',
               // If set will print out debug info
               debug: true,
               options: {
                  // Additional options to pass to the underlying http library
               },
               // Specify a single request inline
               verb: 'get',
               path: '/breweries',
               // Or multiple requests
               requests: [
                  {
                     verb: 'get',
                     path: 'breweries?by_tag=patio'
                  }
               ]
            },
            {
               // Write
               alias: 'write-breweries',
               plugin: 'rest',
               use: 'get-breweries',
               options: {
                  // Additional options to pass to the underlying http library
               },
               // Expect to write this data as json
               json: true,
               // Fictitious endpoint to store the data
               verb: 'post',
               path: '/brewerydb'
            }
         ]
      }
   }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @spikedpunch/forge-plugin-rest

Weekly Downloads

1

Version

0.1.1

License

ISC

Unpacked Size

33 kB

Total Files

24

Last publish

Collaborators

  • spikedpunchvictim