Skip to content

Latest commit

 

History

History
106 lines (70 loc) · 3.47 KB

README.md

File metadata and controls

106 lines (70 loc) · 3.47 KB

sml-server CI

This Standard ML package provides the basics for running an HTTP web server for which requests are handled by Standard ML code.

The functionality is based on the Http library from the sml-http package and utilises the inet-socket functionality of the Standard ML basis library.

Notice: This code is work in progress and the aim is for the library to implement most of the features of SMLserver, a web server Apache module. On the contrary to the original SMLserver design, the present code makes it possible to run native code for servicing requests.

Overview of MLB files

Demonstration

An example use of the server functionality is available in test1.sml. After the mlb-file is compiled, the executable acts as a web server, which can be started from the command-line:

  $ ./test1.exe
  HTTP/1.1 server started on port 8000
  Use C-c to exit the server loop...

Help is available by passing the --help command-line option.

Use of the package

This library is set up to work well with the SML package manager smlpkg. To use the package, in the root of your project directory, execute the command:

$ smlpkg add github.com/diku-dk/sml-server

This command will add a requirement (a line) to the sml.pkg file in your project directory (and create the file, if there is no file sml.pkg already).

To download the library into the directory lib/github.com/diku-dk/sml-server (along with other necessary libraries), execute the command:

$ smlpkg sync

You can now reference the mlb-file using relative paths from within your project's mlb-files.

Notice that you can choose either to treat the downloaded package as part of your own project sources (vendoring) or you can add the sml.pkg file to your project sources and make the smlpkg sync command part of your build process.

Try it!

The library works with either MLton or MLKit.

After checking out the sources, write

$ smlpkg sync

Then simply write make test in your shell (assuming MLKit is installed).

To use MLton as a compiler, write instead:

$ MLCOMP=mlton make clean test

Authors

Copyright (c) 2015-2021 Martin Elsman, University of Copenhagen.