2023-05-12 07:59:32 +02:00
const express = require ( "express" ) ;
const path = require ( "path" ) ;
// Classes
const Wwws = require ( "../models/Wwws.js" ) ;
// Middlewares
const checkHeaders = require ( "../middlewares/checkHeaders" ) ;
const isAuthenticated = require ( "../middlewares/isAuthenticated" ) ;
2023-11-05 12:03:25 +01:00
2023-05-12 07:59:32 +02:00
const router = express . Router ( ) ;
2023-12-05 07:42:35 +01:00
// GET api/wwws/conf/:tribeId/:website
// if profils accessright return the nginx conf in ${conf.dirtown}/tribes/${req.param.tribeId}/www/nginx_${req.params.tribeId}_${req.params.website}.conf
router . get ( "/conf/:tribeId/:website" , checkHeaders , isAuthenticated , ( req , res ) => {
2023-05-12 07:59:32 +02:00
res . send ( Www . configlist ( req . params . tribeId ) ) ;
} ) ;
2023-12-05 07:42:35 +01:00
router . post ( "/conf/:tribeId/:website" , checkHeaders , isAuthenticated , ( req , res ) => {
2023-05-12 07:59:32 +02:00
res . send ( Wwws . create ( req . params . tribeId ) ) ;
} ) ;
module . exports = router ;