Anonymous user
Hello world/Web server: Difference between revisions
→{{header|Prolog}}
(Added prolog) |
|||
Line 790:
=={{header|Prolog}}==
{{works with|SWI
{{works with|YAP}}
<lang Prolog>% The following modules are used in the main module to start a server.
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
% The following module is used in every module that describes a page.
:- use_module(library(http/html_write)).
% Main entry point: starts the server on port 8080.
server
%
:- http_handler('/', say_goodbye, []).
say_goodbye(_Request) :-▼
[h1('Goodbye, World!')]).▼
% Defines the actual page content.
% In this case we're returning a page with the title "Howdy" and the content,
% wrapped in <h1></h1> tags, "Goodbye, World!".
▲say_goodbye(_Request) :- reply_html_page([title('Howdy')],
▲ [h1('Goodbye, World!')]).</lang>
=={{header|PureBasic}}==
|