0.1.1 • Published 4 years ago

postman-builder v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago