@boomi/embedkit-cdn 1.7.3 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/embedkit-cdn.css +1 -1
- package/embedkit-cdn.js +18371 -17891
- package/embedkit-cdn.umd.cjs +292 -164
- package/embedkit-cdn.umd.js +292 -164
- package/package.json +13 -6
- package/public/.gitkeep +0 -0
- package/public/embedkit-cdn.css +0 -1
- package/public/embedkit-cdn.js +0 -43192
- package/public/embedkit-cdn.umd.cjs +0 -2156
- package/public/embedkit-cdn.umd.js +0 -2156
- package/server.js +0 -51
package/server.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const express = require('express');
|
|
3
|
-
|
|
4
|
-
const app = express();
|
|
5
|
-
const port = Number.parseInt(process.env.PORT || '8085', 10);
|
|
6
|
-
const publicDir = process.env.CDN_PUBLIC_DIR
|
|
7
|
-
? path.resolve(process.env.CDN_PUBLIC_DIR)
|
|
8
|
-
: path.join(__dirname, 'public');
|
|
9
|
-
|
|
10
|
-
app.disable('x-powered-by');
|
|
11
|
-
app.set('etag', false);
|
|
12
|
-
|
|
13
|
-
app.get('/health', (_req, res) => res.json({ ok: true }));
|
|
14
|
-
|
|
15
|
-
const staticHandler = express.static(publicDir, {
|
|
16
|
-
fallthrough: false,
|
|
17
|
-
setHeaders(res, filePath) {
|
|
18
|
-
if (filePath.endsWith('.js') || filePath.endsWith('.cjs')) {
|
|
19
|
-
res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
|
|
20
|
-
}
|
|
21
|
-
if (filePath.endsWith('.css')) {
|
|
22
|
-
res.setHeader('Content-Type', 'text/css; charset=utf-8');
|
|
23
|
-
}
|
|
24
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
25
|
-
res.setHeader('Cache-Control', 'no-store');
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
app.use(
|
|
30
|
-
'/cdn',
|
|
31
|
-
staticHandler
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
app.use('/', staticHandler);
|
|
35
|
-
|
|
36
|
-
app.get('/', (_req, res) => {
|
|
37
|
-
res.type('text/plain').send('EmbedKit CDN server running.');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
app.use((err, _req, res, _next) => {
|
|
41
|
-
if (err && err.status === 404) {
|
|
42
|
-
res.status(404).json({ error: 'Not found' });
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
res.status(500).json({ error: 'Server error' });
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
app.listen(port, () => {
|
|
49
|
-
// eslint-disable-next-line no-console
|
|
50
|
-
console.log(`EmbedKit CDN server listening on ${port}. Serving ${publicDir}`);
|
|
51
|
-
});
|