Getting Started

Installation

Docker

The Docker image is the recommended way to run Heart. It runs the dynamically linked binary, so you can require C modules in your Lua, while avoiding the hassle of setting up the dependencies on your own machine.

64-bit Linux

If you're running a 64-bit Linux you can run the Heart binary natively.
  1. 1.
    Navigate to the latest release and download either the standard (dynamic) or static binary
  2. 2.
    Install the binary in your system's path (optional)

When to use the static binary

The standard binary dynamically links LuaJIT and that's great because it means you can require C modules in your Lua code. This gives you access to an abundance of existing code from sources such as LuaRocks. The downside is that you need to have the correct LuaJIT shared object file already installed on your system. Some particularly minimalist distributions might even need to install other dependencies.
The static binary has no dependencies but simply cannot require C modules. If that's something you're not concerned with then this is by far the best way to use Heart.

Basic Usage

main.lua
app = require('heart.v1')
​
app.get('/', function(ctx)
return 'Hello, world!'
end)
Docker
$ docker run -v $(pwd):/root/app -p 3333:3333 hyperspacelogistics/heart:latest app/main.lua
Native
$ ./heart main.lua
Your server should be running now. You can see the result by navigating to localhost:3333 in your browser. 💜
Last modified 2yr ago