All Projects → xran-deex → ats-http

xran-deex / ats-http

Licence: other
An epoll-based HTTP library for ATS2

Programming Languages

ATS
13 projects
Makefile
30231 projects
python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
HTML
75241 projects

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].