maybe it does

This commit is contained in:
Sijmen 2019-11-01 00:23:00 +01:00
parent 3464ecab85
commit 8d0b13a303
Signed by: vijfhoek
GPG key ID: DAF7821E067D9C48

View file

@ -1,19 +0,0 @@
:- http_handler(
root(products),
products_page,
[]
).
% POST /products
products_page(Request) :-
member(method(post), Request), !,
http_read_data(Request, Json, []),
json_to_prolog(Json, product(Name, Price)),
assert_product(Name, Price),
reply_json(Json).
% GET /products
products_page(_Request) :-
bagof(product(Name, Price), product(Name, Price), Products),
prolog_to_json(Products, Json),
reply_json(Json, []).