https://github.com/potch/tinyserve
the little dev server that could
https://github.com/potch/tinyserve
Last synced: 3 months ago
JSON representation
the little dev server that could
- Host: GitHub
- URL: https://github.com/potch/tinyserve
- Owner: potch
- Created: 2022-08-17T06:05:22.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-16T05:44:11.000Z (about 1 year ago)
- Last Synced: 2025-04-30T06:08:01.708Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# tinyserve
- a small local dev server that supports live reloading via [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events)
- only one dependency, [`mime-db`](https://www.npmjs.com/package/mime-db)
- absolutely not for use in production
## installation
`npm install @potch/tinyserve` or `npx tinyserve` if you're feeling frisky
## usage
`> tinyserve [options]`
`> tinyserve -p 1234 -d dist/ -w dist/`
`> tinyserve -w src/ -d build/ -x "npm run build"`
### options
```
-h, --help this help text
-d directory to serve, default is "."
-p port, default is 8080
-w watch file or folder for changes, implies -l
-x run this command on changes, needs -w
-l enable live reload
-r URL path of live reload events, default is "_live
-v enable verbose logging"
```
### live reload
when live reload is enabled, a small script is injected into all HTML responses that listens for a reload signal from the server. that signal can be triggered by either a change to a watched file/directory (via the `-w` option), or local tools can trigger a reload by making a `post` to the live reload route (by default `/_live`).