mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: svg responses
This commit is contained in:
1 parent
aa0069a0a3
commit
8dd0ca9d10
7 files changed
+90
-54
No files matched your search
+13
-2
@@ -1,7 +1,18 @@
|
||||
import express from 'express';
|
||||
import jsxToSvg from './core/ui/jsxToSvg.js';
|
||||
import today from './renderers/today.js';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!');
|
||||
app.get('/', async (req, res) => {
|
||||
const jsx = await today({ server: 'com', id: 1028700193 });
|
||||
const svg = await jsxToSvg(jsx);
|
||||
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'image/svg+xml',
|
||||
'Content-Length': svg.length,
|
||||
});
|
||||
res.end(svg);
|
||||
});
|
||||
|
||||
app.listen(process.env.PORT || 3000);
|
||||
Reference in new issue
Block a user