Sparge is a Go based SPA (single page web application) server.
The purpose of sparge is to allow single page frameworks like Aurelia,
Angular, and React to use "pretty urls" (urls without the #) by serving the index.html
file from the assets directory whenever a static file is not found. Sparge will,
however, return 404 if an extension is used in the path, such as favicon.png
, and
that file is not found.
- Look for the path in the assets directory and return that static asset if it exists.
- If the path contains no extension (e.g.,
.html
,.png
,.jpg
), then returnindex.html
from the assets directory. - Otherwise, return a 404.
Sparge is built with the following dependencies:
The following are instructions to build the sparge binary. This project uses glide to manage dependencies.
$ cd $GOPATH
$ go get github.com/BrewdHQ/sparge
$ cd sparge
$ cd src/BrewdHQ/sparge
$ glide install
$ go build
Put sparge
in your path and run sparge help
for commands and flags.
Commands:
$ sparge help
NAME:
sparge - A SPA (single-page application) server
USAGE:
sparge [global options] command [command options] [arguments...]
VERSION:
1.0.0
COMMANDS:
start Start the SPA server
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
Start:
$ sparge help start
NAME:
sparge start - Start the SPA server
USAGE:
sparge start [command options] [arguments...]
OPTIONS:
--dir value, -d value (default: "./public")
--port value, -p value (default: "8080")
Sparge will serve assets from the ./public
directory by default. Be sure
to specifiy an alternate directory as needed.
- Use the lastest from echo server master branch
- Fixes bug with https redirect loop when server is behind a proxy
- Added flag and env var to specify the log format. See Echo Logger Middleware for details on formatting.
- Added redirect-https flag
- Removed CORS (doesn't make sense for the SPA server, should be handled on the API server)
- Allow settings to be configured with environment variables
- Switched from gin-gonic to echo
- Added a startup banner
The first version
- Start server with a custom port
- Start server with a custom assets directory