neomatrixcode/Merly.jl

"File not working"

Closed this issue · 6 comments

Describe the bug
@page "/" File("Index.html") is not working, it trows

┌ Error: error handling request
│   exception =
│    UndefVarError: File not defined

To Reproduce
Steps to reproduce the behavior:

  1. Set up environment
  2. Arguments
  3. Function/method
  4. See error

Expected behavior
Load the html page

Environment

  • Repository
  • OS: Manaro Linux
  • REPL

Thanks for your report. To help, just answer a few questions:

  • What version of julia are you using?
  • Does the package matter at the beginning of the program? (using Merly)

Julia 1.4.2, and Yes. The error only trows when I try access the url.

Thank you very much, I will review the problem and try to solve it as soon as possible.

Hi! I fixed this bug and other minors, but I had to modify the struct "App". The struct was using functions inside, this was making all files get public in julia > 1.0 even when set webserverpath and webserverfiles. The api will work like this:

ip = "127.0.0.1"
port = 8086
server = App(ip, port) 

webserverpath(server, "cosa")
webserverfiles(server, "*")
@page "/mifile" File(server, "Index.html")

start(server, verbose = false)

I don't know if you will like this modification, I will make a PR soon for you see the modifications.

Thanks for your help, all these changes will be added in version 0.3.0

Hi! PR #15 show the modifications :), if you agree with it I will work in update docs.