From b108cf2e215f7dafabf988f062efda0fc0808ce5 Mon Sep 17 00:00:00 2001
From: Liam Staskawicz
Date: Sun, 4 Nov 2012 14:02:16 -0800
Subject: [PATCH] update readme for new configuration
---
README.md | 58 ++++++++++++++++++++++++++++------------------------------
1 file changed, 28 insertions(+), 30 deletions(-)
diff --git a/README.md b/README.md
index dc8edcf..2ad6f88 100644
--- a/README.md
+++ b/README.md
@@ -1,45 +1,43 @@
-devsrvr
-=======
+# devsrvr
devsrvr is a simple tool to ease local web development in the [Go](http://golang.org/) programming language.
Its main purpose in life is to sit in front of your webapp and automatically recompile it as needed when
new requests come in, making the edit/reload cycle much quicker and more productive.
-Find the project online at http://bitbucket.org/liamstask/devsrvr
+Find the project online at [http://bitbucket.org/liamstask/devsrvr]http://bitbucket.org/liamstask/devsrvr
-Usage
-------------------
+## Usage
-devsrvr has a couple expectations (at the moment):
+To use devsrvr, you need to adjust your app to accept a flag called `addr`, which it uses to configure the address it listens on. A simple example looks like:
-* you use gomake to build your project
-* your app listens via http directly (fcgi and others not yet supported)
+ :::go
+ import (
+ "flag"
+ "net/http"
+ )
-If that works for you, then all that remains is the following:
+ var addr = flag.String("addr", ":9090", "address")
-* create a config file called 'app.json' at the root level of your app, that looks like:
-
- {
- "App": "myapp",
- "DevServerAddress": "127.0.0.1:8000",
- "AppAddress": "127.0.0.1:9000",
- "StartupTime": 10000000
- }
-
- * __App__ is the name of your app's binary - this is the only required field
- * __DevServerAddress__ is the address that devsrvr will listen on - this is the one to enter into our browser
- * __AppAddress__ is the address to connect to your app on - essentially anything different than DevServerAddress is probably fine. Make sure
- this matches whatever your app is configured to listen on.
- * __StartupTime__ is an optional field to specify how long to wait (in nanoseconds) before connecting to your app after rebuilding it
-* devsrvr also currently assumes your Makefile is at the root level of your app as well, though that should probably be configurable...
+ func main() {
+ flag.Parse()
+ log.Println("listening on:", *addr)
+ log.Fatal(http.ListenAndServe(*addr, http.HandlerFunc(fooHandler)))
+ }
-Now, navigate to your app's root directory and invoke `devsrvr`. Enter the value you used for 'DevServerAddress' into your browser
-and you should see your app. Make an edit, and reload your browser - magic!
+By default, devsrvr will listen on `localhost:8000`, and instruct your app to listen on `localhost:8888`.
-If you'd like to run devsrvr from another location, pass the root directory of your app as a flag:
-`devsrvr --approot /path/to/myapp`
+So, to see your app you'd run `devsrvr /path/to/my/app`, and visit `localhost:8000` in your browser.
-License
--------
+Each time you refresh the page, devsrvr will check whether your app needs to be rebuilt, and handle it if necessary. Any build errors are returned to you in the browser.
+
+### Options
+
+By default, devsrvr waits one second for your app to start up before proxying the first request, in order to catch any errors that occur on startup.
+
+You can adjust this startup timeout as well with the `startup` flag:
+
+ devsrvr -startup 0.5s /path/to/my/app
+
+## License
devsrvr is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).
--
2.1.1