web_react/real_estate/server/controllers/listing.controller.js

10 lines
No EOL
268 B
JavaScript

import Listing from "../models/listing.model.js";
export const createListing = async (req, res, next) => {
try {
const listing = await Listing.create(req.body);
return res.status(201).json(listing)
} catch (error) {
next(error)
}
}