sailorproject / sailor

A Lua MVC Web Framework.
MIT License
925 stars 123 forks source link

Lua at client doesn't find starlight when use friendly_urls #152

Open spectrenoir06 opened 7 years ago

spectrenoir06 commented 7 years ago

(working) http://antoine.doussaud.org/?r=main/test/ ( search starlight in /pub/starlight/starlight.js ) (not working) http://antoine.doussaud.org/main/test/ ( search starlight in /main/test/pub/starlight/starlight.js )

Page content:

<h2>Server:</h2>
<?lua@server
    local str = _VERSION .. ", "
    if type(jit) == 'table' then
        str = str .. jit.version .. "<br>"  --LuaJIT 2.0.2
    else
        str = str .. "no JIT<br>"
    end
    page:print(str)
?>
<h2>Client:</h2>
<div id="app"></div>
<?lua@client
    local str = _VERSION .. ", "
    if type(jit) == 'table' then
        str = str .. jit.version  --LuaJIT 2.0.2
    else
        str = str .. "no JIT"
    end
    local app = window.document:getElementById('app')
    print(str)
    app.textContent = str
?>
jperon commented 6 years ago

This comes from this line in latclient :

vm.js_url = conf.lua_at_client.vm_url or "./pub"

The solution is to add a vm_url in conf.lua :

    lua_at_client = {
        vm = "starlight",
        vm_url = "/pub"
    },