Skip to content

matteac/tinyroute_gl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyroute

Package Version Hex Docs

gleam add tinyroute
import gleam/http
import gleam/http/elli // or what you want to use
import gleam/http/request
import gleam/http/response
import gleam/bytes_builder
import tinyroute/router

fn index_handler(
  _req: request.Request(BitArray),
) -> response.Response(bytes_builder.BytesBuilder) {
  let body = bytes_builder.from_string("Hello, World!")
  200
  |> response.new
  |> response.set_body(body)
}

pub fn main() {
  router.new()
  |> router.add(http.Get, "/", index_handler)
  |> router.get_handler
  |> elli.become(on_port: 3000)
}

Further documentation can be found at https://hexdocs.pm/tinyroute.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages