archive
/
tstatic
Archived
1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Jake Howard b86b542998
Document the index file
2018-05-05 12:02:10 +01:00
.circleci Build container on CI 2018-05-04 22:00:13 +01:00
scripts Update test dependencies 2018-03-15 21:29:04 +00:00
site Add additional demo file 2018-01-28 11:37:04 +00:00
src Add more type definitions from types 2018-03-15 22:01:07 +00:00
tests Swap out linter 2018-03-15 21:40:35 +00:00
.gitignore Setup typescript basics 2017-02-14 21:44:28 +00:00
.npmignore Ignore more things 2017-02-20 08:50:01 +00:00
Dockerfile Move install location to `/opt` and install globally 2018-05-05 12:01:07 +01:00
README.md Document the index file 2018-05-05 12:02:10 +01:00
package-lock.json Release 1.2.0 2018-03-15 22:07:57 +00:00
package.json Correct prepublish script 2018-05-04 20:56:34 +01:00
tsconfig.json Replace typings with @types 2018-01-28 11:24:43 +00:00
tslint.json Swap out linter 2018-03-15 21:40:35 +00:00

README.md

tstatic

CircleCI npm npm

The only static-file server you'll ever need!

Features:

Usage

  tstatic <dir> [options]

  -h --help     Show this screen.
  --version     Show version.
  -p <port> --port=<port>  Port to listen on.
  -b <auth> --basic-auth=<auth>   Enable basic-auth.
  -i <ips> --ips=<ips>  Allowed IP addresses.
  -l --list-dir  List Directory.
  -o --open  Open in browser after start.

dir is where your static files are.

404 errors will return with <dir>/.404.html, with status code 404. If this file doesnt exist, the default error page will be shown.

Configuration

port

The port for the server to listen on. Currently supports plain HTTP only

basic-auth

Enable basic-auth for all paths. Currently only supports single credentals.

Format:-b username:password

ips

IP addresses that are allowed to connect to the server.

Format: -i 192.168.1.100,192.168.1.101

list-dir

Enables directory listing. Allow browseing

open

Open the server in the browser one started. It will open in your default browser, and use url http://0.0.0.0:<port>.

Docker

Included in this repo is a Dockerfile to use. The default setup requires being run from the project directory, and will serve /var/www in the container on port 5000. By default, this directory is contains a simple index file, however can be overriden.

Below is an example docker-compose.yml file you can use with it:

version: "2"
services:
  tstatic:
    image: "tstatic"
    build:
        context: .
        dockerfile: Dockerfile
    volumes:
        - ./site/:/var/www
    ports:
        - "5000:5000"