Skip to content

Instantly share code, notes, and snippets.

@kaiser185
Created August 18, 2020 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaiser185/302a6156ea1fbf19fe3711e8a56fb505 to your computer and use it in GitHub Desktop.
Save kaiser185/302a6156ea1fbf19fe3711e8a56fb505 to your computer and use it in GitHub Desktop.
Vanilla SWI
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- http_handler(root(sam), say_hi, []). % (1)
server(Port) :- % (2)
http_server(http_dispatch, [port(Port)]).
say_hi(_Request) :- % (3)
format('Content-type: text/plain~n~n'),
format('Hello World!~n').
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment