@ symbols in JavaScript comments- Express framework

3 weeks ago 26
ARTICLE AD BOX

So, I ran into this block of code in a controller file and I was wondering... What do the @ symbols mean anyway? Are the comments just descriptions of 1. What the controller function does 2. What HTTP method and endpoint the function responds to? Why the @ symbol in the first place? Thanks!

// @desc Get all posts // @route GET /api/posts export const getPosts = (req, res, next) => { const limit = parseInt(req.query.limit); if (!isNaN(limit) && limit > 0) { return res.status(200).json(posts.slice(0, limit)); } res.status(200).json(posts); }; // @desc Get single post // @route GET /api/posts/:id export const getPost = (req, res, next) => { const id = parseInt(req.params.id); const post = posts.find((post) => post.id === id); if (!post) { const error = new Error(`A post with the id of ${id} was not found`); error.status = 404; return next(error); } res.status(200).json(post); };
Read Entire Article