marked/api/dingus.js
Frank Lemanschik a1113e02ca
chore: Update dingus.js import json (#3611)
* Update dingus.js import json

found a better way to import json that works also with other engines like chrome and graalvm .....

* Update dingus.js

Fix: double quote replaced by single quote
2025-02-08 23:36:15 -07:00

20 lines
511 B
JavaScript

import { marked } from '../lib/marked.esm.js';
import pkg from '../package.json' with { type: 'json' };
const version = pkg.version;
const name = 'Marked';
export default function dingus(req, res) {
if (req.method !== 'GET') {
return res.status(405).json({
error: {
code: 'method_not_allowed',
message: 'Only GET requests are supported for this endpoint.',
},
});
}
const { text = '' } = req.query;
const html = marked(text);
res.json({ name, version, html });
}