forestlake / express-api-doc

auto generated express documentation
7 stars 2 forks source link

Can't generate doc. #7

Open nuttikung opened 6 years ago

nuttikung commented 6 years ago

I have tried with babel for run docs.js file.

I got an error as

/source/node_modules/express-api-doc/index.js:93
    _.each(this.app._router.stack, (middleware) => {
                            ^

TypeError: Cannot read property 'stack' of undefined
    at Docks.getAllRoutes (/source/node_modules/express-api-doc/index.js:93:29)
    at Docks.generate (/source/node_modules/express-api-doc/index.js:123:25)
    at Object.<anonymous> (/source/src/docs.js:5:6)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at loader (/source/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/source/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at Object.<anonymous> (/source/node_modules/babel-cli/lib/_babel-node.js:154:22)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

For my code I do nested route.

OS : OSX run in docker node-alpine Version -> express-api-doc: ^0.0.12 Express : ^4

could you please suggest or make an example with es6 with generate doc.

mfaisalhameed commented 6 years ago

i got the same error. Please suggest?

nuttikung commented 6 years ago

I have tried with 2 test cases.

1st test implemented with es5(babel compile) it's working to get a document as expected result but I can't run test with mocha.

2nd test implemented directly to babel style(es6 ++) it's shown error as above that I was make this thread.

Maybe do we need to make feature request for supporting babel style?

Any suggestion?

mikerudge commented 5 years ago

Same thing here!

akoel commented 5 years ago

Exact same thing.