GithubHelp home page GithubHelp logo

Comments (5)

emcpadden avatar emcpadden commented on August 19, 2024

I think I just figured it out, please tell me if this is a good way to do this or if I should be doing something else.

After debugging through it, and also looking at the swagger tools project, I saw that I could do the following in my app.js (which was generated using a127):

a127.init(function(config) {
app.use(a127.middleware(config));

app.use(config['a127.magic'].swaggerTools.swaggerUi());

app.listen(process.env.PORT || 10010);
console.log('try this:\ncurl http://127.0.0.1:10010/hello?name=Scott');
});

Is this the preferred way to do this?

Thanks,
...Ed

from a127-documentation.

theganyo avatar theganyo commented on August 19, 2024

I honestly don't know if there is a preferred way to do this... I do know there is a plan to make Swagger Editor be able to provide the capabilities of Swagger UI (and more) and expose that functionality via configuration. In the meantime, your solution can work... I just can't guarantee it will continue to do so as it relies on implementation details in a127-magic.

from a127-documentation.

emcpadden avatar emcpadden commented on August 19, 2024

OK, thanks Scott. It might be nice if the swagger tools was exposed directly off the config or some other way we could rely on. There is a lot of nice stuff in there that would be great to get at in a reliable way. I would think it would always be there because I think you are already using it for the validation.

Thanks again Scott for the quick reply, it helps a lot as I wrap my head around this stuff.

from a127-documentation.

theganyo avatar theganyo commented on August 19, 2024

True, swagger-tools is likely to always be there. My point is just that since we encapsulate it and don't document access to it, I would consider it "unsupported". What functionality are you interested in accessing from swagger-tools that we don't already expose?

from a127-documentation.

emcpadden avatar emcpadden commented on August 19, 2024

Good point, I guess the things I would really want out of the swagger tools is a way to view the swagger UI and to be able to get the swagger doc in json so that it could be potentially displayed in a dev portal.

For this, maybe if there was an easy way to setup the middleware to optionally expose a /doc and /api-docs route and hide the fact that it comes from the swagger tools ... that would definitely work for me.

In looking further at the swagger tools, I agree that exposig all of that is probably not a great idea since it has way more stuff than I think anyone would need outside the internals.

from a127-documentation.

Related Issues (15)

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.