Moved client-side markdown rendering to this server

This commit is contained in:
2021-12-30 13:22:31 +00:00
parent da0c4bbd05
commit 2e2799f2d3
10 changed files with 166 additions and 6 deletions
+3 -1
View File
@@ -1,4 +1,5 @@
const { articles } = require('../database/models');
const markdownIt = require('markdown-it')();
const route = async (req, res) => {
//check for missing data
@@ -18,7 +19,8 @@ const route = async (req, res) => {
const [instance, created] = await articles.upsert({
title: req.body.title,
author: req.body.author,
body: req.body.body
body: req.body.body,
rendered: markdownIt.render(req.body.body),
});
if (!created) {