Skip to content

Commit

Permalink
nicen up readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Oct 25, 2014
1 parent 8517531 commit 2c492ad
Showing 1 changed file with 35 additions and 27 deletions.
62 changes: 35 additions & 27 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Read a tutorial at <http://leafo.net/posts/lua_on_heroku.html>.


Create an app with the buildpack: Create an app with the buildpack:


$ heroku create --buildpack http://github.com/leafo/heroku-buildpack-lua.git ```bash
$ heroku create --buildpack http://github.com/leafo/heroku-buildpack-lua.git
```


### Dependencies ### Dependencies


Expand All @@ -26,12 +28,14 @@ The buildpack *only* looks at the dependency information. Meaning you don't
have to follow the entire rockspec specification. Minimally, your rockspec have to follow the entire rockspec specification. Minimally, your rockspec
could look something like this: could look something like this:


-- my_app.rockspec ```lua
dependencies = { -- my_app.rockspec
"xavante >= 2.2.1", dependencies = {
"https://rocks.moonscript.org/manifests/leafo/moonscript-0.2.6-1.src.rock", "xavante >= 2.2.1",
"cosmo" "https://rocks.moonscript.org/manifests/leafo/moonscript-0.2.6-1.src.rock",
} "cosmo"
}
```


As shown above, if you want to include external rockspec or rock files by URL As shown above, if you want to include external rockspec or rock files by URL
you can place them in the dependencies table. (This is not supported by you can place them in the dependencies table. (This is not supported by
Expand All @@ -53,28 +57,30 @@ work.


Use [Xavante][5] for a quick web server: Use [Xavante][5] for a quick web server:


-- web.lua ```lua
require "xavante" -- web.lua

require "xavante"
port = ...

port = ...
xavante.HTTP {
server = { host = "*", port = tonumber(port) }, xavante.HTTP {
defaultHost = { server = { host = "*", port = tonumber(port) },
rules = { defaultHost = {
{ rules = {
match = ".", {
with = function(req, res) match = ".",
res.headers["Content-type"] = "text/html" with = function(req, res)
res.content = "hello world, the time is: " .. os.date() res.headers["Content-type"] = "text/html"
return res res.content = "hello world, the time is: " .. os.date()
end return res
} end
}
} }
} }
}
}


xavante.start() xavante.start()
```


Tell Heroku to spawn your web server by creating a file called `Procfile`: Tell Heroku to spawn your web server by creating a file called `Procfile`:


Expand All @@ -83,7 +89,9 @@ Tell Heroku to spawn your web server by creating a file called `Procfile`:
After pushing, if the web server doesn't start automatically, tell Heroku to After pushing, if the web server doesn't start automatically, tell Heroku to
start it: start it:


$ heroku scale web=1 ```bash
$ heroku scale web=1
```




[1]: http://www.lua.org [1]: http://www.lua.org
Expand Down

0 comments on commit 2c492ad

Please sign in to comment.