Skip to content

amochuko/mount-routes

Repository files navigation

route-mounter

Utility to automatically mount Express routers from src/routes/*.

Installation

npm i @numquid/route-mounter

Usage

import express from "express";
import { mountRouters } from "route-mounter";

const app = express();
mountRouters(app);

Folder structure expected:

src/routes/
  home/
    homeRouter.ts
  users/
    usersRouter.ts

If a folder contains an index.ts or a file named *Router.ts, the first router found will be mounted. A folder named home will be mounted at /, others will be kebab-cased and mounted under /.

About

Utility that mounts routers in an Express.js app

Resources

License

Stars

Watchers

Forks

Packages

No packages published