-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (20 loc) · 762 Bytes
/
Copy pathindex.js
File metadata and controls
21 lines (20 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const app = require("nodable");
const bark = require("./bark.js");
app
.use(async (ctx, next) => {
ctx.set("Access-Control-Allow-Credentials", true);
ctx.set("Access-Control-Allow-Methods", "GET,POST,OPTIONS");
ctx.set("Access-Control-Allow-Headers", "Origin,Content-Type,Accept");
ctx.set("Access-Control-Allow-Origin", "*");
await next();
})
.get("/", () => "Repo: https://github.com/metadream/bark-server")
.get("/ping", bark.ping)
.get("/register", bark.register)
.get("/:key/:body", bark.push)
.get("/:key/:title/:body", bark.push)
.post("/:key/:body", bark.push)
.post("/:key/:title/:body", bark.push)
.post("/:key", bark.push)
.options("/:key", () => { })
.listen();