let alone a users route
This commit is contained in:
parent
75134c0cf6
commit
588cac6e95
2 changed files with 9 additions and 1 deletions
3
main.pl
3
main.pl
|
@ -21,7 +21,7 @@
|
||||||
login(username:atom, password:atom).
|
login(username:atom, password:atom).
|
||||||
|
|
||||||
:- json_object
|
:- json_object
|
||||||
user(username:atom, password_hash:atom).
|
user(username:atom).
|
||||||
:- persistent
|
:- persistent
|
||||||
user(username:atom, password_hash:atom).
|
user(username:atom, password_hash:atom).
|
||||||
|
|
||||||
|
@ -35,3 +35,4 @@
|
||||||
|
|
||||||
:- consult('routes/products.pl').
|
:- consult('routes/products.pl').
|
||||||
:- consult('routes/login.pl').
|
:- consult('routes/login.pl').
|
||||||
|
:- consult('routes/users.pl').
|
||||||
|
|
7
routes/users.pl
Normal file
7
routes/users.pl
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
:- http_handler(root(users), users_route, []).
|
||||||
|
|
||||||
|
% GET /users
|
||||||
|
users_route(_Request) :-
|
||||||
|
bagof(user(Username), user(Username, _), Users),
|
||||||
|
prolog_to_json(Users, Json),
|
||||||
|
reply_json(Json).
|
Loading…
Reference in a new issue