Note: This is still early in the project and not ready for production use
A framework to build APIs quickly that focuses primarily on:
- Ease of use
- Fast to code
- Performance
... in that order but it's still pretty fast, like really, really fast.
gleam add glace
import glace
pub fn main() {
glace.new()
|> glace.port(3000) // Skipping this will default to port 4000
|> glace.get("/", fn(_) { glace.html("Hello, World!", status: 200) })
|> glace.get("/text", fn(_) { glace.text("A text response", status: 200) })
|> glace.get("/json", fn(_) { glace.json_string("{\"data\": \"hello\"}", status: 200) })
|> glace.get("/404", fn(_) { glace.not_found() })
|> glace.start()
}
$ bombardier -d 10s --fasthttp http://localhost:4000/
Statistics Avg Stdev Max
Reqs/sec 121995.56 9004.83 145036.35
Latency 1.02ms 235.46us 23.58ms
HTTP codes:
1xx - 0, 2xx - 1220605, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 23.40MB/s