title: Swagger Status Code 200 with no Content
body: <p>When I call my example API in swagger i get Status 200 and no content.
  I called the API using my local Swagger Ui/Editor and browser(Chrome).</p>
  
  <p>I am using swagger+express and use swagger -g and the 
  swagger-express-middleware</p>
  
  <p>I edited my befundGet function to response with a JSON string and a console log which seems to not even run.</p>
  
  <p>Why does it even run a 200 OK when my api call doesn't even call the function defined in swagger? </p>
  
  <p>this is my Index.js for my node server:</p>
  
  <pre><code>var express = require("express");
  var app = express();
  var swaggerMW = require('swagger-express-middleware');
  var MongoClient = require('mongodb').MongoClient;
  
  // Connection URL
  var url = 'mongodb://localhost:27017/test';
  
  // Use connect method to connect to the server
  MongoClient.connect(url, function(err, db) {
      if(err){
          console.log("Connection couldn't be established");
          return false;
      }
  
      console.log("Connected successfully to server");
      //do stuff
      /*insertDocuments(db,function (result) {
          console.log(result);
      });*/
      db.close();
  });
  
  swaggerMW('api/swagger/swagger.yaml', app, function(err, swaggerMW) {
      // Add all the Swagger Express Middleware, or just the ones you need.
      // NOTE: Some of these accept optional options (omitted here for brevity)
      app.use(
          swaggerMW.metadata(),
          swaggerMW.CORS(),
          swaggerMW.files(),
          swaggerMW.parseRequest(),
          swaggerMW.validateRequest(),
          swaggerMW.mock()
      );
  });
  /*
  var insertDocuments = function(db, callback) {
      // Get the documents collection
      var collection = db.collection('documents');
      // Insert some documents
      collection.insertMany([
          {a : 1}, {a : 2}, {a : 3}
      ], function(err, result) {
          assert.equal(err, null);
          assert.equal(3, result.result.n);
          assert.equal(3, result.ops.length);
          console.log("Inserted 3 documents into the collection");
          callback(result);
      });
  }*/
  
  function validateUser(req){
     return true
  }
  
  app.get("/",function (req,res) {
      validateUser(req);
      console.log('got req');
      res.sendFile(__dirname + "/public/index.html");
  });
  app.get("/swag",function (req,res) {
      validateUser(req);
      console.log('got req');
      res.sendFile(__dirname + "/public/swagger-ui/dist/index.html");
  });
  app.get("/api/swagger",function (req,res) {
      validateUser(req);
      res.sendFile(__dirname + "/api/swagger/swagger.yaml");
  });
  app.use(express.static(__dirname + '/public'));
  app.use(express.static(__dirname + '/public/swagger-ui/dist'));
  
  app.listen(4000);
  </code></pre>
  
  <p>I pretty much used the standart swaggerMW settings from the <a href="https://github.com/BigstickCarpet/swagger-express-middleware" rel="nofollow">readme</a> except I removed the app.listen() from the middleware.  </p>
  
  <p>this is my swagger.yaml which i built using the swagger editor:</p>
  
  <blockquote>
  <pre><code>swagger: "2.0"
  info:
    version: "0.0.1"
    title: Toothyfy API
    description: The Toothyfy API for writing/getting docs from the MongoDB. Toothyfy has no production enviroment and is only available in a unstable development enviroment with constant changes.
  # during dev, should point to your local machine
  host: localhost:4000
  # basePath prefixes all resource paths
  basePath: /api
  #tags
  tags:
  - name: patients
    description: patients API calls
  - name: befunde
    description: befunde API calls
  - name: user
    description: user API calls
  - name: pflegeheime
    description: pflegeheime API calls
  #
  schemes:
    # tip: remove http to make production-grade
    - http
    - https
  # format of bodies a client can send (Content-Type)
  consumes:
    - application/json
  # format of the responses to the client (Accepts)
  produces:
    - application/json
  paths:
    /patients:
      # binds swagger app logic to a route
      x-swagger-router-controller: patients
      get:
        tags:
        - patients
        description: Returns Patients to caller
        # used as the method name of the controller
        operationId: patientsGet
        parameters:
          - name: pflegeheim
            in: query
            description: limit the patients to a certain pflegeheim
            required: false
            type: string
        responses:
          "200":
            description: Success
            schema:
              type: array
              items: {}
      put:
        tags:
        - patients
        description: Puts patients to DB 
        # used as the method name of the controller
        operationId: patientsSet
        responses:
          "200":
            description: Success
            schema:
              type: string
              # a pointer to a definition              
    /pflegeheime:
      # binds swagger app logic to a route
      x-swagger-router-controller: pflegeheim
      get:
        tags:
        - pflegeheime
        description: Returns Pflegeheime to caller
        # used as the method name of the controller
        operationId: pflegeheimGet
        parameters:
          - name: pflegeheim
            in: query
            description: limit to a certain pflegeheim
            required: false
            type: string
        responses:
          "200":
            description: Success
            schema:
              type: array
              items: {}
      put:
        tags:
        - pflegeheime
        description: Puts patients to DB 
        # used as the method name of the controller
        operationId: pflegeheimSet
        responses:
          "200":
            description: Success
            schema:
              type: string
              # a pointer to a definition            
    /user:
      # binds swagger app logic to a route
      x-swagger-router-controller: user
      get:
        tags:
        - user
        description: Returns all the user docs to caller
        # used as the method name of the controller
        operationId: userGet
        parameters:
          - name: token
            in: query
            description: token to identify the user
            required: true
            type: string
        responses:
          "200":
            description: Success
            schema:
              type: array
              items: {}
      put:
        tags:
        - user
        description: Puts user specific docs to DB 
        # used as the method name of the controller
        operationId: userSet
        parameters:
          - name: token
            in: query
            description: token to identify the user
            required: true
            type: string
        responses:
          "200":
            description: Success
            schema:
              type: string
              # a pointer to a definition          
    /befunde:
      x-swagger-router-controller: befunde
      get:
        tags:
        - befunde
        description: gets befunde to caller
        # used as the method name of the controller
        operationId: befundeGet
        parameters:
          - name: token
            in: query
            description: token to identify the user
            required: true
            type: string
          - name: patientID
            in: query
            description: PatientId from the patient which befunde you try to retrieve 
            required: true
            type: string
        responses:
          "200":
            description: OK     
      put:
        tags:
        - befunde
        description: Puts user specific docs to DB 
        # used as the method name of the controller
        operationId: befundeSet
        parameters:
          - name: token
            in: query
            description: token to identify the user
            required: true
            type: string
        responses:
          "200":
            description: Success
            schema:
              type: string
              # a pointer to a definition
  </code></pre>
  </blockquote>
  
  <p>this is the befund.js which is in /api/controllers:</p>
  
  <pre><code>module.exports = {
      befundeGet: befundeGet,
      befundeSet: befundeSet
  };
  
  
  function befundeGet(req,res){
          var name = 'stranger';
          console.log(req);
          console.log('Befunde get');
          var hello = util.format('Hello, %s', name);
          res.json(hello);
  }
  
  function befundeSet(req,res){
  
  }
  </code></pre>
  
  <p>It seems to not even run my befundeGet function because my node console stays empty after an API call.</p>