feat: initialize microservice architecture with auth, api, realtime, copernicus, ml, and console modules

This commit is contained in:
Giuseppe Raffa
2026-03-28 15:29:34 +01:00
commit bcfce32adb
89 changed files with 12025 additions and 0 deletions

49
auth/src/index.js Normal file
View File

@@ -0,0 +1,49 @@
const express = require('express');
const nunjucks = require('nunjucks');
const path = require('path');
const parser = require('cookie-parser');
const database = require('./storage/database');
const app = express();
const PORT = process.env.PORT || 3006;
const version = process.env.VERSION;
const vBuild = process.env.VERSION_BUILD;
const vState = process.env.VERSION_STATE;
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(parser());
// Static files
const staticFolder = path.join(__dirname, 'static');
app.use('/static', express.static(staticFolder));
// Nunjucks templates
const templatesFolder = path.join(__dirname, 'templates');
nunjucks.configure(templatesFolder, {
autoescape: true,
express: app,
noCache: true,
watch: false
});
app.set('views', templatesFolder);
app.set('view engine', 'html');
// Routes
const authRoutes = require('./routes/auth');
app.use('/', authRoutes);
// Startup
async function start() {
await database.initDb();
app.listen(PORT, () => {
console.log(`[AUTH] Started on port ${PORT}`);
});
}
start().catch(err => {
console.error('[AUTH] Failed to start:', err);
process.exit(1);
});