micro-fs-router
A micro plugin that leverage the filesystem
Features
- Works out of the box with zero config
- Automatically parse request query, params and body
- Can be extended with a compose function
- Support route params, nested routes, ...
Getting started
Install the project using your favourite package manager.
npm install micro-fs-router
Import the module in your main script and run it with the routes path.
; const router = ; ;
Inside the routes
folder a file called hello.js with a micro function.
{ return `Hello, `;}
Now run it with micro and try to access the service.
$ npx micro index.js
$ curl http://localhost:3000/hello
Hello, micro
$ curl http://localhost:3000/hello?name=test
Hello, test
Contributing
- Create an issue and describe your idea
- Fork the project (https://github.com/b4dnewz/micro-fs-router/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes with logic (
git commit -am 'Add some feature'
) - Publish the branch (
git push origin my-new-feature
) - Add some test for your new feature
- Create a new Pull Request
License
Made with love and MIT license © Filippo Conti