Skip to content

xran-deex/ats-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

ats-http

Quick start (Docker)

docker run -v `pwd`:/src --net=host -it --rm -e CONAN_REMOTE=<conan_package_url> xrandeex/ats2:0.4.2 "conan install . -if build && conan build . -if build"

Dependencies

Dependencies are handled using conan (which depends on Python) Conan https://conan.io

A simple conan helper file needs to be installed to add the correct include paths to the makefile. (https://github.com/xran-deex/atsconan)

Example

#include "../ats-http.hats"
staload "libats/libc/SATS/string.sats"

staload $REQ
staload $RESP

implement main(argc, argv) = 0 where {
    // make the server
    var server = make_server(8888)
    // use 6 threads
    val () = set_thread_count(server, 6)

    // setup a get response handler
    val () = get(server, "/hello", lam (req,resp) =<cloptr1> copy("Hello World") where {
        val () = set_status_code(resp, 200)
        val () = set_content_type(resp, "text/plain")
    })

    // run the server
    val () = run_server(server)
    val () = free_server(server)
}

Install dependencies

conan install . --install-folder build

Build

conan build . --install-folder build

Build and run test app

cd tests
conan install . --install-folder build
conan build . --install-folder build
./tests

About

An epoll-based HTTP library for ATS2

Resources

Stars

Watchers

Forks

Packages

No packages published