2023-10-16 23:11:33 +02:00
|
|
|
|
2023-10-26 20:53:02 +02:00
|
|
|
import operations from './routes/api/operations.js';
|
2023-10-19 19:46:23 +02:00
|
|
|
|
2023-10-18 23:56:56 +02:00
|
|
|
import express from 'express';
|
2023-10-16 23:11:33 +02:00
|
|
|
const app = express();
|
2023-10-26 20:53:02 +02:00
|
|
|
|
2023-10-16 23:11:33 +02:00
|
|
|
const PORT = 8080;
|
2023-10-26 20:53:02 +02:00
|
|
|
|
2023-10-16 23:11:33 +02:00
|
|
|
// Static Middleware
|
2023-10-18 23:56:56 +02:00
|
|
|
app.use(express.static('./public'));
|
2023-10-26 20:53:02 +02:00
|
|
|
|
2023-10-18 23:56:56 +02:00
|
|
|
app.get('/', function (req, res, next) { // TODO: Use EJS?
|
2023-10-16 23:11:33 +02:00
|
|
|
res.render('home.ejs');
|
2023-10-18 23:56:56 +02:00
|
|
|
});
|
|
|
|
|
2023-10-26 20:53:02 +02:00
|
|
|
app.use("/api/operations", operations);
|
2023-10-26 23:01:04 +02:00
|
|
|
//app.use("/api/workflow", workflow);
|
2023-10-26 20:53:02 +02:00
|
|
|
|
2023-11-07 01:45:16 +01:00
|
|
|
// server-node: backend api
|
|
|
|
import api from './server-node/routes/api/index.js';
|
|
|
|
app.use("/api/", api);
|
2023-11-08 00:11:49 +01:00
|
|
|
|
2023-11-07 01:45:16 +01:00
|
|
|
// client-vanilla: frontend
|
2023-11-07 01:40:00 +01:00
|
|
|
app.use(express.static('./client-vanilla'));
|
|
|
|
app.use(express.static('./shared-operations'));
|
2023-10-18 23:56:56 +02:00
|
|
|
|
2023-11-07 01:45:16 +01:00
|
|
|
// serve
|
2023-10-16 23:11:33 +02:00
|
|
|
app.listen(PORT, function (err) {
|
|
|
|
if (err) console.log(err);
|
|
|
|
console.log(`http://localhost:${PORT}`);
|
|
|
|
});
|