prolog-point-of-sale/main.pl

39 lines
943 B
Perl
Raw Normal View History

2019-10-31 23:20:18 +00:00
:- use_module(library(http/http_server)).
:- use_module(library(http/http_client)).
:- use_module(library(http/http_json)).
2019-11-01 00:13:23 +00:00
:- use_module(library(http/http_header)).
2019-10-31 23:20:18 +00:00
:- use_module(library(http/json_convert)).
:- use_module(library(http/json)).
:- use_module(library(persistency)).
:- initialization
http_server([port(8080)]).
:- initialization
absolute_file_name('database.db', File, [access(write)]),
db_attach(File, []).
:- json_object
product(name:atom, price:integer).
:- persistent
product(name:atom, price:integer).
2019-11-01 00:13:23 +00:00
:- json_object
login(username:atom, password:atom).
:- json_object
2019-11-01 00:48:35 +00:00
user(username:atom).
2019-11-01 00:13:23 +00:00
:- persistent
user(username:atom, password_hash:atom).
:- json_object
token(username:atom, token:atom).
:- persistent
token(username:atom, token:atom).
:- json_object
error(error:atom).
2019-10-31 23:20:18 +00:00
:- consult('routes/products.pl').
2019-11-01 00:13:23 +00:00
:- consult('routes/login.pl').
2019-11-01 00:48:35 +00:00
:- consult('routes/users.pl').