api2go icon indicating copy to clipboard operation
api2go copied to clipboard

/x/net/context based routing

Open abrykajlo opened this issue 9 years ago • 9 comments

I have been working on an old fork of ours to convert your routing system to make using golang.org/x/net/context a lot easier for extending functionality of api2go with custom routes.

Only thing is it would introduce breaking changes on routes and middleware. The nice things is that it would allow any new routes to have access to whatever the middleware sets in the context.

Let me know what you think and if you would like something based of your master branch.

here it is

abrykajlo avatar Dec 30 '15 19:12 abrykajlo

hi, yes that makes sense. Currently, the Context can only be reached in our CRUD functions, because you can get it out of the Request struct.

We just have to make sure that everything all the api2go-adapters works with that too.

wwwdata avatar Jan 04 '16 16:01 wwwdata

So if I manage to get api2go-adapters working with my solution would you consider it a viable solution @wwwdata

abrykajlo avatar Jan 05 '16 18:01 abrykajlo

yes. What do you think about it @sharpner ?

wwwdata avatar Jan 06 '16 15:01 wwwdata

yeah that would be awesome. Also I agree, it has to work with the routers. But BC breaks are not that problematic at the moment.

sharpner avatar Jan 07 '16 07:01 sharpner

Cool I will work on this then

abrykajlo avatar Jan 07 '16 17:01 abrykajlo

thank you! Much appreciated!

sharpner avatar Jan 07 '16 20:01 sharpner

I'm really looking forward too for ability to define alternative routes and still benefit from the data that is available to api2go automatically - defined resource routes.

For example, to be able to POST to /order/11/line instead of (or additionally to) posting to /lines and adding order id as a relationship in the POST body)

arcijsg avatar Jan 26 '16 15:01 arcijsg

@arcijsg I am doing what I can for this. We are using api2go at work and it's seems like it might become a priority to get this done. Work has been busy.

abrykajlo avatar Jan 26 '16 16:01 abrykajlo

@abrykajlo, did You have a chance to find a solution, or a different approach has emerged since?

arcijsg avatar Apr 25 '16 08:04 arcijsg