dhruvrajvanshi / Moonshine

Web framework for Crystal language [DEPRECATED in favour of kemal]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

latest build of Moonshine errors

5nyper opened this issue · comments

I crystal dep'd Moonshine right when you pushed your latest commit (coincidence) and it errors with this:

Error in ./server.cr:6: instantiating 'Moonshine::App:Class#new(Array(String))'                                                                                          

app = Moonshine::App.new(static_dirs = ["public"])                                                                                                                       
                     ^~~                                                                                                                                                 

in ./libs/moonshine/moonshine/app.cr:14: undefined constant Request                                                                                                      

                @routes = {} of Moonshine::Route => (Request -> Response) | Controller,                                                                                  
                                       ^~~~~~~                                                       

This is a fault on my side, is there an updated way to declare a static dir with app?

Are you using Moonshine::Request or Moonshine::Response in your code anywhere?
I re factored them into Moonshine::Http module. That might be causing the issue.
Or it could also be due to the order of imports in moonshine.cr which I'm fixing right now.
Can you show me the code?
EDIT:
I have changed the order of imports in moonshine.cr. Can you re check if the issue is solved?

this is my code:

require "moonshine"
require "./renders.cr"
include Moonshine
include Moonshine::Shortcuts

app = Moonshine::App.new(static_dirs = ["public"])
app.define do

    get "/", do |req|
        ok(Cal.new("hi").to_s)
    end
    get "/updates", do |req|
        ok(Uptime.new(`uptime`.gsub(/\n/, "")).to_s)
    end
end
app.run()

and Isnt didnt fix it yet, also example.cr of your repo doesnt work either, same error with invoking 'new' on both file

It was a case of missing includes. The issue should be fixed now.

Yup, Thanks you!