Single-page application server for end-to-end testing.
Project description
Unix: Windows: Metrics: Usage:
Overview
Sappy is a simple, single-page application (SPA) web server for end-to-end testing.
The Python standard library includes a web server that works great for serving up files:
$ python3 -m http.server 8000 Serving HTTP on 0.0.0.0 port 8000 ... $ curl http://localhost:8000/index.html <!DOCTYPE html> <html> <head> <title>Example Index</title> ...
But when used to serve up single-page applications, a 404 is returned whenever any page other than the index is accessed directly:
$ curl http://localhost:8000/login <!DOCTYPE html> <html lang=en> <title>Error 404 (Not Found)</title ...
This project builds on the existing web server code to forward all requests to the index. The single-page application’s client-side routing can then display the page that corresponds to that request’s URL.
Setup
Requirements
Python 3.5+
Installation
Install sappy using pip:
$ pip install sappy
or directly from the source code:
$ git clone https://github.com/jacebrowning/sappy.git $ cd sappy $ python setup.py install
Usage
Build your static website (e.g. an Ember application) for production:
$ ember build --environment=production Building... Built project successfully. Stored in "dist/".
Then serve up the application:
$ sappy Serving /home/browning/project/dist/ on 8080
Check out the documentation or command-line help for additional options:
$ sappy --help
Revision History
0.2.1 (2016/06/14)
Fixed handling of local files.
0.2 (2016/06/09)
Added a --launch option to open the page’s index.
0.1 (2016/06/09)
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sappy-0.2.1.tar.gz
.
File metadata
- Download URL: sappy-0.2.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe74d72f4e1b8f8fd5467fbcd4b24906c29d7aa9557d03daad9d30e059b42c05 |
|
MD5 | 348ac98dcc907ffa802acef1ca0b0a68 |
|
BLAKE2b-256 | 7b85bc09cee16d5b15b4b59df2b0008d71fe3458b9531f03764b32c385c0b225 |