Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get data from response object #599

Closed
2007ay opened this issue Mar 17, 2016 · 2 comments
Closed

how to get data from response object #599

2007ay opened this issue Mar 17, 2016 · 2 comments

Comments

@2007ay
Copy link

2007ay commented Mar 17, 2016

Hi guy I am using swagger for my project, The problem what i am facing "unable to get data from the response object" Can some one help me to identified what i have done wrong below ?

var SwaggerExpress = require('swagger-express-mw');
var app = require('express')();

//this is done for schema validation
 var schemaValidator = require('./api/middlewares/schema_mw/schemaValidator');
 var validator = new schemaValidator();
 var SwaggerUi = require('swagger-tools/middleware/swagger-ui');
 module.exports = app; // for testing

 var config = {
     appRoot: __dirname // required config
 } ;

SwaggerExpress.create(config, function (err, swaggerExpress) {

  if (err) {
    throw err;
}


//install middleware to validate request object
app.use(validator.requestValidator.bind(validator));


app.use(SwaggerUi(swaggerExpress.runner.swagger));


  // install middleware
  swaggerExpress.register(app);

  var middleware = function(req, res , next){
        res.end = function(data , encoding) {
       console.log(data);
   }
   app.use(middleware);
}
    var port = process.env.PORT || 10010;
   app.listen(port);

  });
@ePaul
Copy link
Contributor

ePaul commented Mar 17, 2016

I think you are in the wrong repository. This one is about the Open API specification (formerly Swagger specification), your problem seems about some kind of tooling based on that spec – from the code I would guess the correct project/repository to ask would be https://github.com/apigee-127/swagger-express. Please open an issue there (assuming its documentation doesn't help).

@webron
Copy link
Member

webron commented Mar 17, 2016

@2007ay - yup, for tooling specific questions, please open the ticket on the respective project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants