nfp_sites/nfp_moe/api/server.mjs

24 lines
973 B
JavaScript
Raw Normal View History

import config from '../base/config.mjs'
import Parent from '../base/server.mjs'
import ServeHandler from './serve.mjs'
2022-08-12 23:33:50 +00:00
import ArticleRoutes from './article_routes.mjs'
import PageRoutes from './page_routes.mjs'
export default class Server extends Parent {
init() {
2022-08-12 23:33:50 +00:00
super.init()
let localUtil = new this.core.sc.Util(import.meta.url)
2022-08-12 23:33:50 +00:00
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'),
2022-08-12 23:33:50 +00:00
})
}
}