MCPcopy Create free account
hub / github.com/codemistic/Web-Development / createPost

Function createPost

project_mern_memories/server/controllers/posts.js:30–42  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

28}
29
30export const createPost = async (req, res) => {
31 const { title, message, selectedFile, creator, tags } = req.body;
32
33 const newPostMessage = new PostMessage({ title, message, selectedFile, creator, tags })
34
35 try {
36 await newPostMessage.save();
37
38 res.status(201).json(newPostMessage );
39 } catch (error) {
40 res.status(409).json({ message: error.message });
41 }
42}
43
44export const updatePost = async (req, res) => {
45 const { id } = req.params;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected