First release

This commit is contained in:
Cadence Fish
2020-01-13 01:50:21 +13:00
parent 32e4f3d854
commit 6fd7cc501e
31 changed files with 2759 additions and 348 deletions

17
src/site/api/api.js Normal file
View File

@@ -0,0 +1,17 @@
const {fetchUser} = require("../../lib/collectors")
function reply(statusCode, content) {
return {
statusCode: statusCode,
contentType: "application/json",
content: JSON.stringify(content)
}
}
module.exports = [
{route: "/api/user/(\\w+)", methods: ["GET"], code: async ({fill}) => {
const user = await fetchUser(fill[0])
const data = user.export()
return reply(200, data)
}}
]