A utility that can generate express route information from your project's filesystem
Last updated a year ago by mdhornet90 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fs-to-http-builder 
SYNC missed versions from official npm registry.

CircleCI npm version Mutation testing badge


A utility that can generate Express routes from your project's filesystem


This tool attempts to free you up from having to manually declare routes while still providing you the flexibility to structure your project how you please.

By default, the tool will crawl through your project's filesystem and search for non-test files inside of any folder named "endpoints" (treating "endpoints" as the root path), and create route information for any files or functions inside of files named any of the following:

  • post
  • get
  • put
  • patch
  • delete

This information can then be fed into Express directly.

Custom matchers

In addition to the built-in route matchers that come bundled by default with the tool, you can add custom matchers to handle more complex cases. If you feel the matcher you create is useful, please open a PR to petition for its inclusion as a default!

An Example

If you have a folder structure like the following:

    src: {
        a: {
            endpoints: {
                foo.js (contains function 'get')
        b: {
            endpoints: {
                bar: {
                baz: {
                    _id: {

The tool will generate the following route information:

        route: '/foo',
        method: 'get',
        handler: 'get()'
        route: '/bar',
        method: 'post',
        handler: 'default()' // from post.js
        route: '/baz/:id',
        method: 'put',
        handler: 'default()' // from put.js
        route: '/baz/:id',
        method: 'delete',
        handler: 'default()' // from delete.js

Love it? Hate it? I want to know!

This project was inspired by code in a work project and extended to work with a side project of mine so I fully expect that I made assumptions other people would not - I'll attempt to add some of the first issues myself to track what are likely going to be points of pain for new users, but if the tool isn't working as you'd expect feel free to open up an issue on the project's Issues page.

Current Tags

  • 0.1.0                                ...           latest (8 months ago)

5 Versions

  • 0.1.0                                ...           8 months ago
  • 0.0.4                                ...           10 months ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |