Implement /update
All checks were successful
/ prettier (pull_request) Successful in 41s
/ tests (pull_request) Successful in 47s
/ boot (pull_request) Successful in 42s
/ node-check (pull_request) Successful in 10s
/ node-check (push) Successful in 3s
/ prettier (push) Successful in 26s
/ boot (push) Successful in 26s
/ tests (push) Successful in 35s
All checks were successful
/ prettier (pull_request) Successful in 41s
/ tests (pull_request) Successful in 47s
/ boot (pull_request) Successful in 42s
/ node-check (pull_request) Successful in 10s
/ node-check (push) Successful in 3s
/ prettier (push) Successful in 26s
/ boot (push) Successful in 26s
/ tests (push) Successful in 35s
This commit is contained in:
parent
10f8c6fc36
commit
cea6569580
1 changed files with 22 additions and 0 deletions
22
index.js
22
index.js
|
@ -117,6 +117,28 @@ app.get("/hit/:key", async function (req, res) {
|
||||||
.status(counter_res == null ? 500 : 200)
|
.status(counter_res == null ? 500 : 200)
|
||||||
.json({ value: counter_res });
|
.json({ value: counter_res });
|
||||||
});
|
});
|
||||||
|
app.get("/update/:ns/:key", async function (req, res) {
|
||||||
|
var counter_res = await counter_increment(
|
||||||
|
req.params.ns,
|
||||||
|
req.params.key,
|
||||||
|
req.query.amount,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
return res
|
||||||
|
.status(counter_res == null ? 500 : 200)
|
||||||
|
.json({ value: counter_res });
|
||||||
|
});
|
||||||
|
app.get("/update/:key", async function (req, res) {
|
||||||
|
var counter_res = await counter_increment(
|
||||||
|
"default",
|
||||||
|
req.params.key,
|
||||||
|
req.query.amount,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
return res
|
||||||
|
.status(counter_res == null ? 500 : 200)
|
||||||
|
.json({ value: counter_res });
|
||||||
|
});
|
||||||
app.get("/get/:ns/:key", async function (req, res) {
|
app.get("/get/:ns/:key", async function (req, res) {
|
||||||
var e = await get_counter_value(req.params.ns, req.params.key);
|
var e = await get_counter_value(req.params.ns, req.params.key);
|
||||||
return res.status(e == null ? 404 : 200).json({ value: e });
|
return res.status(e == null ? 404 : 200).json({ value: e });
|
||||||
|
|
Loading…
Reference in a new issue