nfp_sites/nfp_moe/api/server.mjs

24 lines
973 B
JavaScript

import config from '../base/config.mjs'
import Parent from '../base/server.mjs'
import ServeHandler from './serve.mjs'
import ArticleRoutes from './article_routes.mjs'
import PageRoutes from './page_routes.mjs'
export default class Server extends Parent {
init() {
super.init()
let localUtil = new this.core.sc.Util(import.meta.url)
this.flaskaOptions.appendHeaders['Content-Security-Policy'] = `default-src 'self'; script-src 'self' talk.hyvor.com; style-src 'self' 'unsafe-inline'; img-src * data: blob:; font-src 'self' data:; object-src 'none'; frame-src talk.hyvor.com` //; frame-ancestors 'none'`
this.routes.article = new ArticleRoutes()
this.routes.page = new PageRoutes()
this.routes.serve = new ServeHandler({
pageRoutes: this.routes.page,
articleRoutes: this.routes.article,
root: localUtil.getPathFromRoot('../public'),
version: this.core.app.running,
frontend: config.get('frontend:url'),
})
}
}