This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class UserFetcher | |
abstract def call : User? | |
class FromEmail < UserFetcher | |
@email : String? | |
def initialize(@email : String?, @query = UserQuery.new) | |
end | |
def call : User? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Some | |
def initialize(value) | |
@value = value | |
end | |
def value | |
@value | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro generic_crud(*names) | |
{% for name, index in names %} | |
generic_create {{name}} | |
generic_read {{name}} | |
generic_update {{name}} | |
generic_delete {{name}} | |
{% end %} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "kemal" | |
config do |env| | |
env.response.content_type = "application/json" # OR "text/html" OR other | |
env.set_default_header "Header", "value" | |
public_folder "path/to/your/folder" | |
env.custom_attributes["key1"] = value1 | |
env.custom_attributes["key2"] = value2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "kemal" | |
macro generic_create(name) | |
post "/{{name}}" do |env| | |
puts "create {{name}}" | |
end | |
end | |
macro generic_read(name) | |
get "/{{name}}" do |env| |