Answer the question
In order to leave comments, you need to log in
How to properly export a function (errors in eslint)?
There is a page.js controller
import Page from '../models/page';
export async function Create(req, res, next) {
const pageData = req.body;
const userId = req.user._id;
pageData.userId = userId;
try {
var page = await Page.create(pageData);
} catch ({
message
}) {
return next({
status: 400,
message
});
}
res.json(page);
}
export async function GetAll(req, res, next) {
res.json('getAll');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question