14 lines
405 B
JavaScript
Executable File
14 lines
405 B
JavaScript
Executable File
#!/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 })));
|
|
});
|
|
console.log('Starting KaTeX server');
|
|
app.listen(8000);
|