Express + TypeScript + Mongo – Part 4 – Swagger

You may also like...

4 Responses

  1. sandhya says:

    Hi
    Thanks for your article.
    When I clone your github project it is showing

    import express from ‘express’;
    ^^^^^^^

    SyntaxError: Unexpected identifier

    Please can you help me how to resolve the issue.
    I have tried in all scenarios. But did not work.
    Thanks
    Bhavani

    • Dan says:

      This is always a fun error to diagnose because it’s vague and can be caused by a few things.

      Let’s start with making sure you’re using Node 10.x or higher. For instance, I’m using Node 10.14.2, and I am not seeing this error. I also want to confirm that you did run ‘npm install’ after cloning.

  2. Ahmet Yeşil says:

    hi,
    What is the reason for this error?

    $ tsoa routes && tsoa swagger
    Generate routes error.
    Error: Missing entryFile: Configuration must contain an entry point file.
    at C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:223:27
    at step (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:45:23)
    at Object.next (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:26:53)
    at C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:20:71
    at new Promise ()
    at __awaiter (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:16:12)
    at validateRoutesConfig (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:217:55)
    at Object. (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:394:42)
    at step (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:45:23)
    at Object.next (C:\Users\ahmet\Desktop\Project\todo-server\node_modules\tsoa\dist\cli.js:26:53)
    error Command failed with exit code 1.

    • Dan says:

      Likely, this is a result of a new tsoa. The tsoa.json file covered in the project is based on an older version (2.3.8). You’ll want to make sure your project is on this version.

      Otherwise, I believe all you would need to do is move one of the “entryFile” keys found in either “swagger” and “routes” to the top level of the tsoa.json file and remove it from both entries. Meaning:

      {
      “entryFile”: “./src/app.ts”,
      “swagger”: {
      “outputDirectory”: “.”
      },
      “routes”: {
      “basePath”: “/”,
      “routesDir”: “./src”
      }
      }

      I *think* this would work.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.