How to document API using jsdoc which has following form (single file)
// api.js
exports.addSocketEvents = function(socket) {
/**
* This will do that and ...
* @param {Object} data Some data
* @param {string} data.bla Something about bla
* @param {number} data.n Some number
*/
socket.on('something_1', function(data) { ... });
/**
* Another function that will do ..
* @param {string} id of something
*/
socket.on('something_2', function(id) { ... });
...
};
exports.addRoutes = function(app) {
/**
* PATCH /something/:id/juhu
* Will do this and that and will respond with ...
* @param {string} _id Id of bonus document
*/
app.patch('/something/:id/juhu', function(req, res) {...});
/**
* GET /something
* Will fetch and respond back with ...
*/
app.get('/something', function(req, res) {...});
...
};
My only idea is to add @namespace
above exports and @lends
above anonymous functions but that results in empty documentation.