Skip to content

totallymoney/filename-basepath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Mount express routes using filename as basepath

Resources

License

Stars

Watchers

Forks

Packages

No packages published