feat: svg responses

This commit is contained in:
TresAbhi committed 2023-06-26 17:25:28 +00:00
1 parent aa0069a0a3
commit 8dd0ca9d10
7 files changed
+90 -54

No files matched your search

+13 -2
View File
@@ -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);