@totallymoney/filename-basepath

0.1.0 • Public • Published

Filename Basepath

Mount express routes using filename as basepath.

Useful for efficiently mocking multiple http dependencies.

Example

$ yarn add -D @totallymoney/filename-basepath
$ tree
.
├── mocks
│   └── my-route.js
└── package.json
$ cat mocks/my-route.js

var router = require("express").Router();

router.get("/foo", function (_, res) {
  res.send("bar");
});

module.exports = router;
$ yarn filename-basepath mocks

Sourcing routes from: my-repo/mocks
/my-route
Running on port 3000
$ curl -s http://localhost:3000/my-route/foo

"bar"

Development

Make sure you belong to the totallymoney npm organization. Then make changes to the source code and publish. Enter the new version number as prompted. A git push command will run automatically after publishing.

$ git commit -am "Improve logging"
$ yarn publish --access public

Readme

Keywords

none

Package Sidebar

Install

npm i @totallymoney/filename-basepath

Weekly Downloads

243

Version

0.1.0

License

MIT

Unpacked Size

3.96 kB

Total Files

5

Last publish

Collaborators

  • tbanham
  • lcolgan
  • nickblair
  • klaatu01
  • iqabsent
  • ac1989
  • totallymoney_svc