Giter VIP home page Giter VIP logo

livedev's Introduction

livedev

livedev is a development proxy server for golang that allows live reloading.
It supports multiple server configuration.
It uses the request's header "Host" field to determine which server the request should be routed to.
If no match is found the request is routed the default server.

Compatible with: go version go1.0.2+

Features

  • Cross-platform
  • Unobstructive. No code change required
  • Simple json configuration file
  • Multiple server support
  • Automated build service.
  • Dependency change detection

Installation

go get -u github.com/qrtz/livedev

Configuration

livedev is controlled by a json configuration file:

  • port: (int, default:"80") proxy port
  • GOROOT: (string, optional)
  • GOPATH: (string, optional)
  • server: ([]Server) A list of Server object with the following options:
    • GOROOT: (string, optional) Server specific GOROOT for compiling with different go version
    • GOPATH: ([]string, optional) Server specific GOPATH.
    • host: (string) server hostname (must be unique)
    • port: (int, optional) server port
      When omitted, the server must accept addr=<hostname:port> argument.
    • workspace: (string, optional) The project root. It will be added to the build process GOPATH
      If omitted, an atempt will be made to guess it from target
    • target: (string, optional) Build target. The file that contains the main function.
      if target is not in the GOPATH, livedev will attempt to add it by guessing the workspace from the filename.
      When target is ommited, the build step is skipped.
    • resources: (optional) A list of resources such as template files. Any change to these files will cause the server to restart.
      • ignore: (string, optional) filename pattern to ignore.
      • paths: ([]string) A list of files or directories to monitor
    • bin: (string, optional) server executable file. When absent, it default to /tmp/livedev[hostname]
    • builder: ([]string, optional) To use a builder other than the go build tool. The first element is the command and the rest its arguments
    • startup: ([]string, optional) server startup argument list
    • default: (bool, optinal) Specifies the default server.
      Defaults to the first server in the list
    • startupTimeout: (int, default=5) Specifies the time (in seconds) limit to wait for the server to complete the startup operation.

Example:

{
    "port":80,
    "server":[
        {
            "host":"example.com",
            "port": 8080,
            "target":"/projects/example/src/main.go",
            "resources":{
                "ignore":"static*",
                "paths":["/projects/expemple/templates"]
             },
            "bin":"/projects/example/bin/example",
            "startup":["-res", "/path/to/resource/directory"],
            "default":true
        }
    ]
}

Usage

$ livedev -c config.json

Assuming you used the above configuration and added example.com to your host file, point your browser to http://example.com
livedev will start your app, compiling it if necessary and forward the request to it on the configured port.

You can have multiple app running with different hostname. Just add another entry in the server list.

livedev's People

Contributors

qrtz avatar wathiede avatar

Watchers

 avatar  avatar  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.