This repository has been archived on 2021-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
custom-nix/blog/katexserver.js

12 lines
347 B
JavaScript

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 })));
});
app.listen(8000);