The Crystal programming language | http://crystal-lang.org | Fund Crystal's development: http://is.gd/X7PRtI | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/
Good Evening form LDN :)
I try to do that but I’ve
20 | {% methods = method_listing(descriptions) %}
^-------------
Error: undefined macro method: 'method_listing'
This is the code
macro method_listing(descriptions)
%methods = [] of String
{% for description in descriptions %}
{% for key in description["methods"] %}
%methods << %key
{% end %}
{% end %}
%methods.uniq!
end
macro method_switch(descriptions)
{% methods = method_listing(descriptions) %}
end
Do u have some Idea ???
@[Cocaine::Route(path: "/", verb: "GET")]
def controller_index(context : HTTP::Server::Context, params : Cocaine::Param)
context.response.content_type = "text/plain"
context.response.print "Hello world, got #{context.request.path} !"
end
@[Cocaine::Route(path: "/user/:id", verb: "GET")]
def controller_user(context : HTTP::Server::Context, params : Cocaine::Param)
context.response.content_type = "text/plain"
context.response.print "Hello world, got #{context.request.path} !"
end
################################################################################
# Server
################################################################################
server = HTTP::Server.new { |context| Cocaine.match_endpoint context }
server.listen "0.0.0.0", 5000
HTTP::Server
, so to be faster than that you might need to get creative
GC.malloc*
and it segfaults only with -Dpreview_mt when calling an empty function. https://github.com/didactic-drunk/fiber_stats.cr/pull/1#discussion_r665800802