Summary
Create jsserve - a thin wrapper package around JSS that provides a drop-in alternative to npx serve with added REST write capabilities (PUT/DELETE).
New repo: github.com/JavaScriptSolidServer/jsserve
Difficulty: 20/100
Estimated Effort: 1 day
Dependencies: #107 (--public flag)
Motivation
npx serve is hugely popular for quick static file serving, but it's read-only. Developers often need:
- Quick file upload endpoint for testing
- Simple WebDAV-like functionality
- REST API for local development
- File sync between devices on LAN
jsserve fills this gap: "serve, but you can write too"
Comparison
| Feature |
npx serve |
npx jsserve |
| Zero config |
✅ |
✅ |
| Static file serving |
✅ |
✅ |
| Directory listings |
✅ |
✅ |
| CORS |
✅ |
✅ |
| Custom port |
✅ |
✅ |
| SPA mode |
✅ |
✅ |
| PUT (write files) |
❌ |
✅ |
| DELETE |
❌ |
✅ |
| PATCH |
❌ |
✅ |
| ETags/caching |
❌ |
✅ |
| Conditional requests |
❌ |
✅ |
| Upgrade to Solid |
❌ |
✅ |
Usage
# Install
npm i -g jsserve
# Serve current directory (read + write enabled)
jsserve
# Serve specific folder
jsserve ./public
# Custom port
jsserve -p 8080
# Read-only mode (exactly like npx serve)
jsserve --read-only
# With basic auth
jsserve --auth user:pass
# Enable full Solid features
jsserve --solid
Output
┌─────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:3000 │
│ - Network: http://192.168.1.5:3000 │
│ │
│ GET/PUT/DELETE enabled │
│ │
└─────────────────────────────────────────┘
REST API Examples
# Read file
curl http://localhost:3000/file.txt
# Write file
curl -X PUT -d "content" http://localhost:3000/file.txt
# Delete file
curl -X DELETE http://localhost:3000/file.txt
# Conditional update (optimistic concurrency)
curl -X PUT -H 'If-Match: "etag"' -d "new" http://localhost:3000/file.txt
Repository Structure
github.com/JavaScriptSolidServer/jsserve/
├── bin/
│ └── jsserve.js # CLI entry point (~80 LOC)
├── package.json # Depends on jss
├── README.md
└── LICENSE
Implementation
The wrapper is ~80 LOC that:
- Parses serve-compatible CLI args
- Translates to JSS flags
- Spawns JSS with
--public flag
- Prints a nice banner
{
"name": "jsserve",
"bin": { "jsserve": "./bin/jsserve.js" },
"dependencies": {
"commander": "^12.0.0",
"jss": "^0.1.0"
}
}
Difficulty Breakdown
| Component |
LOC |
Difficulty |
| CLI wrapper |
~80 |
10/100 |
| Package setup |
~20 |
5/100 |
| README/docs |
~100 |
5/100 |
| Total |
~200 |
20/100 |
Related Issues
Summary
Create
jsserve- a thin wrapper package around JSS that provides a drop-in alternative tonpx servewith added REST write capabilities (PUT/DELETE).New repo:
github.com/JavaScriptSolidServer/jsserveDifficulty: 20/100
Estimated Effort: 1 day
Dependencies: #107 (
--publicflag)Motivation
npx serveis hugely popular for quick static file serving, but it's read-only. Developers often need:jsservefills this gap: "serve, but you can write too"Comparison
npx servenpx jsserveUsage
Output
REST API Examples
Repository Structure
Implementation
The wrapper is ~80 LOC that:
--publicflag{ "name": "jsserve", "bin": { "jsserve": "./bin/jsserve.js" }, "dependencies": { "commander": "^12.0.0", "jss": "^0.1.0" } }Difficulty Breakdown
Related Issues
--publicflag (required dependency)