faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
_whitelogger has joined #amber
<FromGitter> <proyb6> @AllanKlaus Go web frameworks are usually faster than Crystal but it’s the libraries that’s matter. If your team can accept break changes and keen in binding C libraries in Crystal, that would be nice.
_whitelogger has joined #amber
<FromGitter> <elorest> @proyb6 What is your source on this? ⏎ ⏎ > Go web frameworks are usually faster than Crystal but it’s the libraries that’s matter
<FromGitter> <AllanKlaus> @proyb6 So its no recommended to create an API using crystal? I already used Go in my team but they dont like it
<FromGitter> <drum445> @AllanKlaus why do you say that? Crystal has been great for creating APIs for me - REST JSON ones that is
<FromGitter> <Blacksmoke16> athena would be great for that, however not sure how i would feel using it atm for a legit thing
<FromGitter> <drum445> nice self plug
<FromGitter> <Blacksmoke16> :shrug: is what i was intending it to be used for
<FromGitter> <Blacksmoke16> is what i use it for
<FromGitter> <drum445> It looks good man
<FromGitter> <drum445> Hadn't seen it before
<FromGitter> <Blacksmoke16> thanks, yea has some neat features that are unique in the crystal framework land
<FromGitter> <Blacksmoke16> if crystal keeps heading in the annotation direction, im ahead of the curve ;)
<FromGitter> <drum445> haha you sure are
<FromGitter> <drum445> @Blacksmoke16 in general do you split your routes up into a routes.cr file then have the controllers seperate, or do you usually just combine the two like you have shown in your examples here: ⏎ https://github.com/Blacksmoke16/athena/blob/master/docs/routing.md#defining-routes ⏎ ⏎ I don't just mean in athena, but other API frameworks too [https://gitter.im/amberframework/amber?at=5c42448020b78635b64619cd]
<FromGitter> <AllanKlaus> @drum445 Was a question based on what @proyb6 said
<FromGitter> <Blacksmoke16> imo depends what you're doing
<FromGitter> <drum445> @Blacksmoke16 how so mate?
<FromGitter> <Blacksmoke16> like if you only have a few routes might just be easier to have one controller
<FromGitter> <drum445> @AllanKlaus ah right, I wouldn't worry about benchmarks that much tbh. Unless something is drastically slower than it's competition it's fine; the end user doesn't care. In a real scenario they're sitting behind a reverse proxy anyway so you lose time there
<FromGitter> <Blacksmoke16> but the more routes you have/need to manage, makes sense to split them out into more manageable controller files
<FromGitter> <drum445> Yeah I do that atm, have many controller files, but I've seen frameworks that have a routes.xx file in a config dir, which then call the relevant controller
<FromGitter> <Blacksmoke16> athena doesnt have that. its all auto registered when you inherit from `Athena::Routing::ClassController`
<FromGitter> <Blacksmoke16> rails is like that for example, have to tell what controller manages what route and stuff
<FromGitter> <drum445> Yeah you can do stuff like this in rails etc.. ⏎ ⏎ ```get '/patients/:id', to: 'patients#show'``` [https://gitter.im/amberframework/amber?at=5c4245820721b912a5a04b8c]
<FromGitter> <Blacksmoke16> yup
<FromGitter> <drum445> but in my current project, I am combining the route with the controller like so: ⏎ ⏎ ``` post "/post" do ⏎ PostDAO.new.get ⏎ end ⏎ ``` [https://gitter.im/amberframework/amber?at=5c4245bcc45b986d11818ff8]
<FromGitter> <drum445> both ways are fine I guess?
<FromGitter> <Blacksmoke16> whatever works for you imo
<FromGitter> <drum445> Cool, think I need to stop being concerned with the tiny details like that and just get on with coding
<FromGitter> <Blacksmoke16> premature optimization can be evil
<FromGitter> <drum445> "premature optimisation is the root of all evil"
<FromGitter> <Blacksmoke16> context goes into it as well, a personal webapp project? doesnt really matter. Large scale prod api? maybe put more thought into how it will scale in future
<FromGitter> <drum445> Very true
<FromGitter> <Blacksmoke16> combining them like that, unless you are reusing some of the controller logic between routes, would result in a lot of extra code to do what you could just do in the route do block no?
<FromGitter> <Blacksmoke16> controller approach would allow you to test some code more easily
<FromGitter> <drum445> I'm using sinatra so an example controller file controllers/post.rb looks like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c42471820b78635b6462912]
<FromGitter> <drum445> is that what you mean by the controller appraoach/
<FromGitter> <Blacksmoke16> ah no, the `PostDAO.new.get` confused me
<FromGitter> <Blacksmoke16> was thinking like some people i saw use kemal like
<FromGitter> <Blacksmoke16> ```get "posts/:id" do |ctx| ⏎ PostsController.new(ctx).get ⏎ end``` [https://gitter.im/amberframework/amber?at=5c4248247a0f4d5b19ceef9a]
<FromGitter> <Blacksmoke16> like use kemal for the routing, but handle the route action in another class
<FromGitter> <Blacksmoke16> vs just doing all the logic within the route block
<FromGitter> <drum445> That is from one of my projects lol
<FromGitter> <Blacksmoke16> xD
<FromGitter> <drum445> Yeah I binned that and went with the controller think I have now
<FromGitter> <Blacksmoke16> pretty much
<FromGitter> <Blacksmoke16> KISS
<FromGitter> <drum445> Exactly
<FromGitter> <drum445> and YAGI
<FromGitter> <drum445> So you reckon my layout is pretty standard, no problems with it you can see/
<FromGitter> <drum445> ?
<FromGitter> <Blacksmoke16> as far as i know?
<FromGitter> <Blacksmoke16> i usually find just go with it and try it out , can always change it in the future if you find a better way