[![Unix Build Status](https://img.shields.io/github/actions/workflow/status/jacebrowning/sappy/main.yml?branch=main&label=linux)](https://github.com/jacebrowning/sappy/actions)
[![Windows Build Status](https://img.shields.io/appveyor/ci/jacebrowning/sappy.svg?label=windows)](https://ci.appveyor.com/project/jacebrowning/sappy)
[![Coverage Status](https://img.shields.io/codecov/c/gh/jacebrowning/sappy)](https://codecov.io/gh/jacebrowning/sappy)
[![PyPI License](https://img.shields.io/pypi/l/sappy.svg)](https://pypi.org/project/sappy)
[![PyPI Version](https://img.shields.io/pypi/v/sappy.svg)](https://pypi.org/project/sappy)
[![PyPI Downloads](https://img.shields.io/pypi/dm/sappy.svg?color=orange)](https://pypistats.org/packages/sappy)
# 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:
```sh
$ python3 -m http.server 8080
Serving HTTP on 0.0.0.0 port 8080 ...
$ curl http://localhost:8080/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:
```sh
$ curl http://localhost:8080/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.8+
## Installation
Install `sappy` with pip:
```sh
$ pip install sappy
```
or directly from the source code:
```sh
$ 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:
```sh
$ ember build --environment=production
Building...
Built project successfully. Stored in "dist/".
```
Then serve up the application:
```sh
$ sappy
Serving /home/browning/project/dist/ on 8080
```
Check out the [documentation](http://sappy.readthedocs.io/en/latest/cli) or command-line help for additional options:
```sh
$ sappy --help
```
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/sappy",
"name": "sappy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "testing,end-to-end,single-page-application,web-servicer",
"author": "Jace Browning",
"author_email": "jacebrowning@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cc/1e/ec68ec1f305d3a1d64dc72f22471702469ae190528f87d6e32694a77d014/sappy-1.2.tar.gz",
"platform": null,
"description": "[![Unix Build Status](https://img.shields.io/github/actions/workflow/status/jacebrowning/sappy/main.yml?branch=main&label=linux)](https://github.com/jacebrowning/sappy/actions)\n[![Windows Build Status](https://img.shields.io/appveyor/ci/jacebrowning/sappy.svg?label=windows)](https://ci.appveyor.com/project/jacebrowning/sappy)\n[![Coverage Status](https://img.shields.io/codecov/c/gh/jacebrowning/sappy)](https://codecov.io/gh/jacebrowning/sappy)\n[![PyPI License](https://img.shields.io/pypi/l/sappy.svg)](https://pypi.org/project/sappy)\n[![PyPI Version](https://img.shields.io/pypi/v/sappy.svg)](https://pypi.org/project/sappy)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/sappy.svg?color=orange)](https://pypistats.org/packages/sappy)\n\n# Overview\n\nSappy is a simple, single-page application (SPA) web server for end-to-end testing.\n\nThe Python standard library includes a web server that works great for serving up files:\n\n```sh\n$ python3 -m http.server 8080\nServing HTTP on 0.0.0.0 port 8080 ...\n\n$ curl http://localhost:8080/index.html\n<!DOCTYPE html>\n<html>\n <head>\n <title>Example Index</title>\n...\n```\n\nBut when used to serve up single-page applications, a `404` is returned whenever any page other than the index is accessed directly:\n\n```sh\n$ curl http://localhost:8080/login\n<!DOCTYPE html>\n<html lang=en>\n <title>Error 404 (Not Found)</title\n...\n```\n\nThis project builds on the existing web server code to forward all requests to the index. The single-page application\u2019s client-side routing can then display the page that corresponds to that request\u2019s URL.\n\n# Setup\n\n## Requirements\n\n* Python 3.8+\n\n## Installation\n\nInstall `sappy` with pip:\n\n```sh\n$ pip install sappy\n```\n\nor directly from the source code:\n\n```sh\n$ git clone https://github.com/jacebrowning/sappy.git\n$ cd sappy\n$ python setup.py install\n```\n\n# Usage\n\nBuild your static website (e.g. an Ember application) for production:\n\n```sh\n$ ember build --environment=production\nBuilding...\nBuilt project successfully. Stored in \"dist/\".\n```\n\nThen serve up the application:\n\n```sh\n$ sappy\nServing /home/browning/project/dist/ on 8080\n```\n\nCheck out the [documentation](http://sappy.readthedocs.io/en/latest/cli) or command-line help for additional options:\n\n```sh\n$ sappy --help\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Single-page application server for end-to-end testing.",
"version": "1.2",
"project_urls": {
"Documentation": "https://sappy.readthedocs.io",
"Homepage": "https://pypi.org/project/sappy",
"Repository": "https://github.com/jacebrowning/sappy"
},
"split_keywords": [
"testing",
"end-to-end",
"single-page-application",
"web-servicer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2adb88b2df47407dcbd8e0219f867081ca71111d8d53a22d4515a2d88ae0633f",
"md5": "aeaf9a6ab2e073e594a15f4c0e0b905b",
"sha256": "7e72191fc64bc5220adee56819d074d2bfa62fa9686cabf8b8068b3b944b35da"
},
"downloads": -1,
"filename": "sappy-1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aeaf9a6ab2e073e594a15f4c0e0b905b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 6901,
"upload_time": "2023-08-16T17:46:02",
"upload_time_iso_8601": "2023-08-16T17:46:02.786861Z",
"url": "https://files.pythonhosted.org/packages/2a/db/88b2df47407dcbd8e0219f867081ca71111d8d53a22d4515a2d88ae0633f/sappy-1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cc1eec68ec1f305d3a1d64dc72f22471702469ae190528f87d6e32694a77d014",
"md5": "21b1f0690afcf95a5703be8ddc68cd20",
"sha256": "6aaeb79bfcc8b06ce33b2fcd547131486cec7020c6888a5173de7254ee224b7e"
},
"downloads": -1,
"filename": "sappy-1.2.tar.gz",
"has_sig": false,
"md5_digest": "21b1f0690afcf95a5703be8ddc68cd20",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 5335,
"upload_time": "2023-08-16T17:46:06",
"upload_time_iso_8601": "2023-08-16T17:46:06.082836Z",
"url": "https://files.pythonhosted.org/packages/cc/1e/ec68ec1f305d3a1d64dc72f22471702469ae190528f87d6e32694a77d014/sappy-1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-16 17:46:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jacebrowning",
"github_project": "sappy",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"appveyor": true,
"lcname": "sappy"
}