postman-builder

0.1.1 • Public • Published

Postman Builder

This is ALPHA and extreme WIP

Generate postman routes automatically based upon express routes

npm i postman-builder -D

add to scripts { build:postman: 'postman-builder' }

Place postmanbuilder.config.js at root of your project with the following options:

module.exports = {
  app: require(`./src/app`), // whever your express entrypoint exists
  collection: `collection name`, // postman collection name
  workspaceId: "", // workspace id generated by postman,
  postmanKey: "" // private api key provided by postman,
  framework: 'Koa', // default is express (optional)
  envVariable: '{{env}}' // optional. {{env}} is default prefix for all urls in postman
};

Add preformated json bodys to postman by adding this middleware to your route. Your application will fill in the blanks, but if none exist in your app, postman data will not be deleted.

const meta = require("postman-builder"); // express by default
// or
const meta = require("postman-builder").koa;

router.post(
  "/bar/baz",
  meta({
    sampleRequest: { im_some_key: "ok" }
  }),
  (req, res, next) => {
    res.json("blarf");
  }
);

Thank you to express-list-endpoints package for boilerplate to pull all express endpoints: https://github.com/AlbertoFdzM/express-list-endpoints

Readme

Keywords

Package Sidebar

Install

npm i postman-builder

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

20.3 kB

Total Files

11

Last publish

Collaborators

  • fazulk