This repository has been archived on 2024-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
katex-server/server.js

14 lines
405 B
JavaScript
Raw Normal View History

2022-03-27 17:06:16 -07:00
#!/usr/bin/env node
const katex = require('katex');
const express = require('express');
const bodyParser = require('body-parser');
app = express();
app.use(bodyParser.json());
app.post('/render', (req, res) => {
res.send(req.body.equations.map(eq =>
katex.renderToString(eq.str, { throwOnError: false, displayMode: eq.display })));
});
2022-03-27 17:27:01 -07:00
console.log('Starting KaTeX server');
2022-03-27 17:06:16 -07:00
app.listen(8000);