Giter Club home page Giter Club logo

testserve's Introduction

testserve

Donate

A simple port-sharing proxy for development on multiple local domains, supports websockets, SSL, and queuing requests whilst development server restarts.

Features

  • Quick (near instant) startup
  • Built in DNS server to redirect *.test to 127.0.0.1 (requires additional configuration for your system to use this server)
  • Proxies regular HTTP requests and websocket connections based on the Host HTTP header
  • Easy to configure
  • Subdomain configuration is updated on a per-request basis - no need to restart server
  • supports xip.io domains
  • SSL termination (using SNI to support multiple domains on one port)
  • Self-signed SSL certificate generation and help installing
  • testserve run --exponential-backoff will automatically re-attempt requests when your development server restarts (e.g. due to file changes) saving you from receiving the error page in the intervening seconds (ALPHA)

Status

This package is NOT ready for production usage, it's only intended for use on your own development machine!

Getting Started

testserve itself should run on Linux and OS X, but to have .test domains resolve to localhost and to have it run on port 80 you need to do a little additional configuration.

We've currently only instructed you how to do this on OS X and Ubuntu; pull requests are welcome.

Installing

npm install -g testserve
testserve install

Follow the instructions to set up port forwarding and DNS resolution.

Running

To run the server:

testserve run

We don't currently daemonize the server, pull requests to add this functionality would be welcome. In the mean time we recommend you set up pm2 and then tell it to run testserve with:

pm2 run /path/to/testserve -- run --exponential-backoff && pm2 dump

Configuring subdomains

Port forwarding

To set up a subdomain, simply run

testserve add mysite 1337

This'll tell testserve to proxy all HTTP requests for mysite.test and mysite.*.*.*.*.xip.io to localhost:1337

Static files

Alternatively, to serve static files:

testserve add staticsite /path/to/public

This'll tell testserve to serve static content from /path/to/public/ to anyone requesting http://staticsite.dev/

SSL certificates

If you want a local domain to be served with SSL you must generate a certificate for it:

testserve ssl staticsite

Then follow the instructions.

DNS resolution fails whilst offline

This is an issue with discoveryd (it also affects Pow - see basecamp/pow#471) - should be fixed by updating to OS X 10.10.4

TODO

Pull requests welcome!

  • Tests
  • Daemonize
  • Scripts directory organzation
testserve
└── extras
    ├── macos-launchd
    ├── supervisord
    ├── systemd
    └── systemv

Forked from testserve.

testserve's People

Contributors

anbud avatar barthez avatar benjie avatar nathanielvarona avatar vitaly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.