Javascript 使用swagger jsdoc记录express API的确切步骤是什么?

Javascript 使用swagger jsdoc记录express API的确切步骤是什么?,javascript,node.js,api,express,swagger,Javascript,Node.js,Api,Express,Swagger,我想使用NPM中的swagger jsdoc记录我的express router端点。 我从未在用户面前大摇大摆,我想知道在代码中编写它的确切步骤,以及最终如何生成YAML/JSON文档文件 router.post('/docToSafe', (req, res, next) => { let SafeProperties = req.body.SafeProperties; let DocumentsArray = req.body.Documents; if ((S

我想使用NPM中的swagger jsdoc记录我的express router端点。 我从未在用户面前大摇大摆,我想知道在代码中编写它的确切步骤,以及最终如何生成YAML/JSON文档文件


router.post('/docToSafe', (req, res, next) => {

  let SafeProperties = req.body.SafeProperties;
  let DocumentsArray = req.body.Documents;


  if ((SafeProperties.PathToSafe) && (SafeProperties.ZipName) && (DocumentsArray[0].DocID)) {

    res.writeHead(200, { 'content-type': 'text/plain' });
    res.end();

  }

  else {

    res.writeHead(500, { 'content-type': 'text/plain' });
    res.end();

  }
}

签出此示例repo-