diff --git a/pages/api/comments/create.js b/pages/api/comments/create.js index c159b89..7426e70 100644 --- a/pages/api/comments/create.js +++ b/pages/api/comments/create.js @@ -3,8 +3,9 @@ import dbConnectionInit from '../../../libs/database/dbConnection'; import postModel from '../../../libs/database/models/posts'; - export default async function createComment(req, res) { + dbConnectionInit(); + if (req.method === 'POST') { if (!req.query.id){ return res.status(400).json({