New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

node-file-router

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-file-router

A powerful file-based routing for Node.js

Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
722
-18.69%
Maintainers
1
Weekly downloads
 
Created
Source

Node File Router

ci Status npm downloads license

A powerful file-based routing for Node.js.

  • Technology Agnostic:
    • Pure Node HTTP
    • Bun
    • Express
    • Sockets
    • ... whatever compatible with the interface
  • 0 dependencies
  • CommonJS and ES modules support
  • TypeScript support
  • 100% test coverage
api/
├── profile/
│   └── orders.[post].ts - methods in any filenames
├── catalog/
│   └── [[...tags]].ts - several segments
├── collection/
│   └── [cid]/ - slugs in folders
│       └── products/
│           └── [pid].ts - slugs in files
├── index.ts - root
└── _404.ts - not found response    
  • [POST]: /profile/orders → /api/profile/orders.[post].ts
  • /catalog/men/black/denim → /api/catalog/[[...tags]].ts
  • /collection/77/products/13 → /api/collection/[cid]/products/[pid].ts
  • / → index.ts

Methods in a file:

export default {
  get(req, res, routeParams) {},
  post(req, res, routeParams) {},
  patch(req, res, routeParams) {},
}

Single response function:

export default function (req, res, routeParams) {}

Documentation

Visit website to get started and view the full documentation.

Usage:

Methods routing:

Route matching:

Support other protocols and frameworks:

Examples

Visit examples folder to see samples with different module systems, adapters, and use cases.

Developing

To begin development and contribution, read this guide.

Community

Ask questions, voice ideas, and share your projects on Github Discussion.

Keywords

nodejs

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts