Metadata-Version: 2.4
Name: sappy
Version: 1.3
Summary: Single-page application server for end-to-end testing.
License: MIT
License-File: LICENSE.md
Keywords: testing,end-to-end,single-page-application,web-servicer
Author: Jace Browning
Author-email: jacebrowning@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Testing
Requires-Dist: click (>=8.0,<9.0)
Requires-Dist: minilog (>=2.0,<3.0)
Project-URL: Documentation, https://sappy.readthedocs.io
Project-URL: Homepage, https://pypi.org/project/sappy
Project-URL: Repository, https://github.com/jacebrowning/sappy
Description-Content-Type: text/markdown

[![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.10+

### Installation

Install this tool globally with [pipx](https://pipxproject.github.io/pipx/) (or pip):

```sh
$ pipx install sappy
```

or add it to your [Poetry](https://python-poetry.org/docs/) project:

```sh
$ poetry add sappy
```

## 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
```

