Giter Club home page Giter Club logo

Comments (2)

dougwilson avatar dougwilson commented on June 22, 2024 1

Hi @nfroidure . Typically even though require allows you do do that, the danger of reaching into a module if it's not documented you can do so is that an internal file rearrangement can break you without warning (if you don't pin to a specific version).

The API of this module was created before I took over it and it does have a lot wanting in it. I think we could change the API if someone wanted to put together a proposal of what exactly they wanted the API to look like and the use-cases this would enable over the existing API 👍

from negotiator.

nfroidure avatar nfroidure commented on June 22, 2024

Thanks for your answer. I use this module here https://github.com/nfroidure/swagger-http-router/blob/master/src/lib.js#L3-L4

To build a extractResponseSpec function https://github.com/nfroidure/swagger-http-router/blob/master/src/lib.js#L79-L97

In this router, I choose to not use the built in req/res objects unlike in every major frameworks for several reasons (snapshot testing, functional programming, function composition over middlewares...). For that matter, the requests and responses are raw JSON serializable objects so I cannot use APIs that expect a regular NodeJS response object (here is a more complete explanation of the why https://github.com/nfroidure/swagger-http-router#goal ).

I guess that the extractResponseSpec could be used with little changes to provide a functional API in this module.

from negotiator.

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.