mirror of
https://github.com/xfarrow/blink
synced 2025-06-27 09:03:02 +02:00
update
This commit is contained in:
26
backend/apis/nodejs/api.js
Normal file
26
backend/apis/nodejs/api.js
Normal 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}`);
|
||||
});
|
Reference in New Issue
Block a user