This commit is contained in:
xfarrow
2023-10-11 12:37:20 +02:00
parent 0fbe12b5d4
commit 711e6d210a
12 changed files with 165 additions and 147 deletions

View File

@ -0,0 +1,26 @@
/*
** This code is part of Blink
** licensed under GPLv3
*/
// require() always returns a function
const express = require('express');
const api_controller = require('./api_controller.js');
// We can do express() because the express
// module exports a function. Exporting a function
// means making a JavaScript function defined in one
// module available for use in another module.
const app = express();
const port = 3000;
// Middleware which parses JSON for POST requests
app.use(express.json());
app.post('/blinkapi/register', api_controller.register_async);
app.post('blinkapi/login', api_controller.login);
// Start the server
app.listen(port, () => {
console.log(`Blink API server is running on port ${port}`);
});