Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
titaniumnetwork-dev
GitHub Repository: titaniumnetwork-dev/Ludicrous
Path: blob/main/corrosion/lib/rewrite.js
1223 views
1
// -------------------------------------------------------------
2
// WARNING: this file is used by both the client and the server.
3
// Do not use any browser or node-specific API!
4
// -------------------------------------------------------------
5
const URLWrapper = require('./url');
6
const CookieRewriter = require('./cookie');
7
const CSSRewriter = require('./css');
8
const HTMLRewriter = require('./html');
9
const JSRewriter = require('./js');
10
const defaultConfig = {
11
prefix: '/service/',
12
codec: 'plain',
13
ws: true,
14
cookie: true,
15
title: 'Service',
16
};
17
18
class Rewrite {
19
constructor(config = defaultConfig) {
20
this.config = Object.assign(defaultConfig, config);
21
this.prefix = this.config.prefix;
22
this.url = new URLWrapper(this.config || {});
23
this.codec = this.url.codec;
24
this.cookies = new CookieRewriter(this);
25
this.css = new CSSRewriter(this);
26
this.js = new JSRewriter(this);
27
this.html = new HTMLRewriter(this);
28
};
29
};
30
31
module.exports = Rewrite;
32
33