Giter Club home page Giter Club logo

Comments (4)

saintedlama avatar saintedlama commented on May 19, 2024

I like the idea to make serve more flexible. The API looks a little awkward since these route middleware is only applied when using serve something like

restifyMongoose(models.Note, opts, authenticate, f1, f2, f3).serve('/notes', [authenticate, f1, f2, f3], [after1,after2, after3], server);

would fit better

from restify-mongoose.

djensen47 avatar djensen47 commented on May 19, 2024

I think you had a copy and paste error. Did you mean …

restifyMongoose(models.Note, opts).serve('/notes', [authenticate, f1, f2, f3], [after1,after2, after3], server);

I think I would put server after the path since it is required.

var notes = restifyMongoose(models.Note, opts);
notes.serve('/notes', server, [authenticate, f1, f2, f3], [after1,after2, after3]);

If you want to chain handlers before and after this function signature isn't going to work. Maybe something like this:

var notes = restifyMongoose(models.Note, opts);
var handlerChain = {
  before: [Function],
  after: [Funtion],
};
notes.serve('/notes', server, handlerChain);

Thoughts?

from restify-mongoose.

saintedlama avatar saintedlama commented on May 19, 2024

Looks good. When we now call that options we have a nice extension point for server

var notes = restifyMongoose(models.Note, opts);
var options = {
  before: [Function],
  after: [Funtion],
};
notes.serve('/notes', server, options);

from restify-mongoose.

djensen47 avatar djensen47 commented on May 19, 2024

Okay, I've implemented this in my pull request.

from restify-mongoose.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.