swimlane / node-microservice-demo

✨ Example project for Micro-services w/ Node + TypeScript + Express + Swagger + Docker
449 stars 132 forks source link

Response validation failed #5

Open daniele-zurico opened 7 years ago

daniele-zurico commented 7 years ago

Hi all, I'm trying to use the pets project i got everything up an running however when I try to call: http://localhost:8080/pets I receive:

Error: Response validation failed: invalid content type (text/html).  These are valid: application/json
    at Object.module.exports.validateContentType (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/swagger-tools/lib/validators.js:242:11)
    at ServerResponse.res.end (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/swagger-tools/middleware/swagger-validator.js:202:20)
    at Array.write (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/finalhandler/index.js:266:9)
    at listener (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/on-finished/index.js:169:15)
    at onFinish (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/on-finished/index.js:100:5)
    at callback (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/ee-first/index.js:55:10)
    at IncomingMessage.onevent (/Users/danielezurico/Downloads/node-microservice-demo-master/petstore/node_modules/ee-first/index.js:93:5)
    at emitNone (events.js:86:13)
    at IncomingMessage.emit (events.js:186:7)
    at endReadableNT (_stream_readable.js:974:12)

any idea?

umaxfun commented 6 years ago

No controllers are wired up in https://github.com/swimlane/node-microservice-demo/blob/master/petstore/src/config/Express.ts#L36

No idea how to fix =(

umaxfun commented 6 years ago

However, there's one %) Line 37 has to be changed to: controllers: [ controllersPath + '/**/*.js' ],