FromGitter has quit [Remote host closed the connection]
FromGitter has joined #amber
<FromGitter>
<tekanic> Hi. I’m testing out Amber for the first time. I had some questions I hope someone can answer. I created a new amber app and then I created a new controller called MobileController (which inherited from Amber::Controller::Base). I then created another controller called ApiController and tried to inherit from MobileController. I get a compile error “undefined constant MobileController in api_controller.cr. Can
<FromGitter>
... you inherit controllers in Amber? Is there something that I’m missing here?
<FromGitter>
<Blacksmoke16> make sure `MobileController` is required before its used
<FromGitter>
<Blacksmoke16> when you do `require "./controllers/**"` for example, that requires in ABC order
<FromGitter>
<Blacksmoke16> so `MobileController` wouldn't be defined yet when its going to be used in `ApiController`
<FromGitter>
<Blacksmoke16> @tekanic
<FromGitter>
<tekanic> That makes sense thank you. A couple more questions if you don’t mind. I’m looking to create two different rest apis with Crystal. The first api will use a custom http header for authentication purposes. Is it better to put the authentication mechanism in a plug or would it be better to just use a custom controller for authentication purposes? The second API needs to use token authentication. Can you point
<FromGitter>
... me to any documentation that shows how to set that up? Finally, does the Bcrypt library work the same way that it works in Rails? I use the auth_token gem in rails for bearer token type functionality and it works great. Looking to speed up the api by using Crystal/Amber instead of Rails but I want to use the existing ... [https://gitter.im/amberframework/amber?at=5c7f06db293ac75db55c93b6]
<FromGitter>
<tekanic> Any other documentation or direction would be appreciated. Thank you!
<robacarp>
bcrypt works the same as in ruby. The crystal docs should show you how to work with it.
<robacarp>
I'd recommend a custom plug to do your header validation