https://github.com/anuraghazra/nodejs-dynamic-restapi
Nodejs Directory Based REST APIs Endpoints
https://github.com/anuraghazra/nodejs-dynamic-restapi
Last synced: 3 months ago
JSON representation
Nodejs Directory Based REST APIs Endpoints
- Host: GitHub
- URL: https://github.com/anuraghazra/nodejs-dynamic-restapi
- Owner: anuraghazra
- Created: 2020-02-21T16:22:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T02:25:20.000Z (over 2 years ago)
- Last Synced: 2025-03-17T08:45:10.251Z (3 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Nodejs Directory Based APIs
Experiment with nodejs REST API Endpoints, dynamically created endpoints based on directory structure.
Considering this directory structure api endpoints will generate as follows
```
├───api
│ ├───todos
│ │ - index.js
│ ├───users
│ │ - [id].js
│ │ - index.js
```index.js files are treated as main entrypoint `/` instead of `/index`
By using [filename].js we can make :id params
- GET /api/todos/
- GET /api/users/:id
- GET /api/users/