Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update routes after running #38

Closed
habemus-papadum opened this issue Apr 13, 2015 · 2 comments · May be fixed by #39
Closed

Update routes after running #38

habemus-papadum opened this issue Apr 13, 2015 · 2 comments · May be fixed by #39

Comments

@habemus-papadum
Copy link

Hi -- Is it possible to update a route after the server is running?
If I begin with:

app = Morsel.app()

get(app, "/test") do req, res
    "Original"
end

@async start(app, 8000)

And then later on in the repl session:

get(app, "/test") do req, res
    "Updatedl"
end

Getting /test always returns Original

Fyi, having the route handler call a global function and updating the global function in the repl works just fine e.g.

foo(req,res) = "bar"

get(app, "/test") do req, res
   foo(req,res)
end

##later 
foo(req,res) = "baz"

Also adding completely different routes after the server is started works fine as well -- perhaps there is some tweaking needed in the route tree logic?

thanks!

@yfractal
Copy link
Contributor

@lilinjn
I have sent a pull request for this issue, it works fine in my local.

@habemus-papadum
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants