R
R
RxApi
Search…
R
R
RxApi
Introduction
Basic configuration
HTTP
Router
Routes/Controller
WEBSOCKETS
Events
DATABASE/ORM (KNEX)
Basic configuration
Migrations and cli
Powered By
GitBook
Routes/Controller
Files in "./http/routes/users.js"
1
const
http
=
require
(
'express'
).
Router
();
2
3
module
.
exports
=
db
=>
{
4
5
http
.
get
(
'/firstUser'
,
(
req
,
res
)
=>
{
6
db
(
'users'
).
insert
({
7
username
:
"username"
,
8
surname
:
"surname"
,
9
password
:
"password"
10
})
11
.
then
(
res
=>
{
12
res
.
json
(
res
)
13
})
14
.
catch
(
err
=>
{
15
res
.
json
(
err
)
16
})
17
});
18
19
http
.
get
(
'/bye'
,
(
req
,
res
)
=>
{
20
res
.
json
({
response
:
"bye"
});
21
});
22
23
return
http
;
24
};
Copied!
HTTP - Previous
Router
Next - WEBSOCKETS
Events
Last modified
1yr ago
Copy link