2019.7.23 • Published 6 years ago
@inc/here v2019.7.23
@inc/here
A dependency-free server for single page apps
Here is a zero dependency static file server with history api fallback defaults to support rapid single page app development.
Forked from Luke Jacksonn's Servør because I just wanted a nice file server (and, quiet). No watching, no reloads.
Features
- 🗂 Serve static content like scripts, styles, and images from a directory
- 🖥 Reroute all non-file requests like
/or/adminto a single file - ⏱ Install using
npxand be running in the browser in ~1 second - 📚 Readable source code that encourages learning and contribution
Usage
Add @inc/here as a dev dependency using npm i @inc/here -D or run directly from the Terminal:
npx here <directory> <fallback> <port> <open flag> <verbose flag><directory>path to serve static files from (defaults to current directory.)<fallback>the file served for all non-file requests (defaults toindex.html)<port>what port you want to serve the files from (defaults to8080)<open flag>if you want here to launch the site in your default browser, pass--open(defaults tofalse)<verbose flag>if you want logging, pass--verbose(defaults tofalse)
Example usage with npm scripts in a project's package.json file:
{
"scripts": {
"start": "npx here www index.html 8080 --verbose"
}
}