Skip to content

not able to get 'unless' working #24

@beyondszine

Description

@beyondszine

Hi there,

Can you please help me out with this code wher I am not yet able to get this working ?

(function(){
  'use strict';
  var unless = require('express-unless');
  var express = require('express');

  var app = express();

  var fun1  = function(req,res,next){
    console.log('fun1 was called');
    next();
  };
  fun1.unless=unless;

  var fun2  = function(req,res,next){
    console.log('fun2 was called');
    console.log(req.method);
    console.log(req.url);
    next();
  };

  app.use(fun1.unless({method : 'GET', 'url':'/'}));

  app.get('/', fun2,function(req, res,next) {
    console.log('root route hit');
    res.send('ok');
  });

  app.listen(process.env.PORT || 5553);


})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions