These are chat archives for gin-gonic/gin

13th
Aug 2015
Joey
@Twister915
Aug 13 2015 08:10
Hey, I'm kinda new to golang in general, anyone have an example of the best way to organize routes that represent resources? Like if I want to have two functions named index in different files, can I do that? and if so, how do I add an entire file's worth of funcs to the router, or does that not make sense in the context of golang?
Chris
@ChristopherRabotin
Aug 13 2015 09:25
@itsjamie no Abort or AbortWithError will stop all other middlewares from being called: https://github.com/gin-gonic/gin/blob/5f2f8d9cb443a2c31babfbaf7980370995522d5f/context.go#L104 .
Jamie Stackhouse
@itsjamie
Aug 13 2015 11:05

@ChristopherRabotin Right, however it doesn't stop the unraveling of middlewares that were executing before-hand. So in my handlers I often use it to respond with a status code.

If you are doing this inside a middleware, and want to send a status code, but continue to call additional middlewares that already haven't executed, you will probably need to run context.Writer.WriteHeader(code)

Chris
@ChristopherRabotin
Aug 13 2015 11:35
Okay that's good to know.
Thanks