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"); const router = express.Router(); // 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) => { res.send(Www.configlist(req.params.tribeId)); }); router.post("/conf/:tribeId/:website", checkHeaders, isAuthenticated, (req, res) => { res.send(Wwws.create(req.params.tribeId)); }); /** * @api {get} /adminapi/wwws/initlocaldb/:tribe/:appname - Get app data model * @apiGroup Wwws * @apiName getappcontext * @apiDescription Get data base from backend to localstorage * * @apiParams {string} tribe (adminapi,smatchit,..) to looking for * @apiParams {string} appname agregate a full data referential to store localy * @apiSuccess {object} contain data model for a local web or mobile app in a PWA logical in the language of the header * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * {"status":200, "ref":"Odmdb", "msg":"datamodel", "data":{} */ router.get("/initlocaldb/:tribe/:appname", checkHeaders, isAuthenticated, (req, res) => { console.log('pass localstorage') const getlocal = Wwws.initlocaldata(req.params.tribe,req.params.appname,req.session.header.xprofils,req.session.header.xlang); res.status(getlocal.status).json(getlocal) }); module.exports = router;