Compare commits

...
This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.

2 Commits
nlp ... web

Author SHA1 Message Date
Diogo Cordeiro
dd4d3276c4 Add form 2018-12-23 19:33:42 +00:00
Diogo Cordeiro
515d5cb7c0 Start of a WEB framework 2018-12-23 18:28:30 +00:00

View File

@ -5,7 +5,7 @@
* *
* polimani.pl * polimani.pl
* *
* Assignment 1 - Polynomial Manipulator * Assignment - Polynomial Manipulator
* Programming in Logic - DCC-FCUP * Programming in Logic - DCC-FCUP
* *
* Diogo Peralta Cordeiro * Diogo Peralta Cordeiro
@ -40,6 +40,52 @@
*/ */
:- use_module(library(porter_stem)). :- use_module(library(porter_stem)).
/*******************************
* WEB SETTINGS *
*******************************/
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_path)).
:- use_module(library(http/html_write)).
:- use_module(library(http/mimetype)).
:- use_module(library(http/http_error)).
:- use_module(library(settings)).
:- use_module(library(error)).
:- setting(http:served_file_extensions,
list(atom),
[ html ],
'List of extensions that are served as plain files').
:- setting(http:port,
integer,
3040,
'Default port').
% HTTP handler for pages
:- http_handler(root(''), web_polyplay, []).
/*******************************
* WEB SERVER *
*******************************/
server :-
setting(http:port, Port),
server([port(Port)]).
server(Options) :-
http_server(http_dispatch, Options).
/*******************************
* WEB SERVICES *
*******************************/
web_polyplay(_Request) :-
format('Content-type: text/html~n~n'),
format('Welcome to PolyMani!~n'),
format('Ask me something:~n'),
format('<form method="GET" action="process"><input type="text"></input></form>~n').
/******************************* /*******************************
* NLP * * NLP *
*******************************/ *******************************/