lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I had already installed Xavante. As I didn't know how Orbit works, I
imagined it internally called Xavante. So I imagined an embeded
server.

This things are still confused for me. I found a brief tip of Xavante.
It descrives the configuration, but I could not understand how to run
it and where to place the files.

Well, I am better than I was.
2015-09-26 12:39 GMT-03:00, Ryan Pusztai <rpusztai@gmail.com>:
> You need a web server. Just running the app doesn't work. You need to use
> apache2 (https://luanova.org/setting-orbit-to-use-apache2/) or Xavante
> (luarocks install wsapi-xavante).
>
> I highly recommend Xavante. It installs easily and then you just run `$
> wsapi app.lua`. I believe it defaults to port 8080. See the help on `wsapi
> --help` for more details.
>
> (I am not in front of a PC right now so some of the commands might be off
> by a little bit.)
>
> Hope this helps.
> --
> Regards,
> Ryan
>
> Sent from my phone
> Coming back to Lua 5.1, the error disappear. But, I was not able to
> launch the script! It seems to be very close.
>
> No errors, but no results. Doing "$ lua app.lua" at the terminal,
> nothing is writen, not is returned...
>
> But, actually, I didnt no either what URL to call! What'is the port?
> Sould I call as "localhost:3000"?
>
> The module is:
>
> -- hello.lua
> #!/usr/bin/env wsapi.cgi
>
> local orbit = require('orbit')
>
> module('hello', package.seeall, orbit.new)
>
> function index(web)
> return render_index()
> end
>
> hello:dispatch_get(index, '/index')
>
> function render_index()
> return [[
> <html>
> <title>Hello world</title>
> <body>
> <P> This is a hello world page</p>
> </body>
> </html>]]
> end
>
> orbit.htmlify(hello, "render_.+")
>
> return M
>
> The launcher is:
> #!/usr/bin/env wsapi.cgi
>
> return require('hello')
>
>
>
> 2015-09-26 11:10 GMT-03:00, Ryan Pusztai <rpusztai@gmail.com>:
>> Orbit only supports Lua 5.1. Hope this helps.
>> --
>> Regards,
>> Ryan
>>
>> Sent from my phone
>> On Sep 26, 2015 9:38 AM, "luciano de souza" <luchyanus@gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> I tried to run an example of Orbit application. I have a very short
>>> knowledge about web servers, so I try to follow the tips I have found.
>>>
>>> First of all, I have installed everything:
>>>
>>> $ sudo apt-get install lua5.2
>>> $ cd /home/luciano/Downloads/luarocks
>>> $ sudo chmod +x configure
>>> $ sudo ./configure
>>> $ sudo make build
>>> $ sudo make install
>>> $ sudo make bootstrapp
>>> $ sudo luarocks install orbit
>>> $ sudo luarocks install xavante
>>> $ sudo luarocks install wsapi-xavante
>>>
>>> So I regard this example:
>>>
>>> -- x.lua
>>> #!/usr/bin/env wsapi.cgi
>>>
>>> local orbit = require('orbit')
>>>
>>> module('hello', package.seeall, orbit.new)
>>>
>>> function index(web)
>>> return Render_Index()
>>> end
>>>
>>> hello:dispatch_get(index, '/index')
>>>
>>> function Render_Index()
>>> return [[
>>> <html>
>>> <title>Um teste</title>
>>> <body>
>>> <P> Eis aqui um teste. </p>
>>> </body>
>>> </html>]]
>>> end
>>>
>>> orbit.htmlify(hello, "render_.+")
>>>
>>> return M
>>>
>>> I run:
>>> $ lua x.lua
>>>
>>> and I got this error:
>>>
>>> lua: /usr/local/share/lua/5.2/orbit.lua:9: attempt to call local
>>> 'setfenv' (a nil value)
>>> stack traceback:
>>>         /usr/local/share/lua/5.2/orbit.lua:9: in main chunk
>>>         [C]: in function 'require'
>>>         x.lua:3: in main chunk
>>>         [C]: in ?
>>>
>>> What's wrong?
>>>
>>> In fact, my few knowledges can't detect the error.
>>>
>>> I thanky you very much for any help.
>>>
>>> Best regards,
>>>
>>>
>>> --
>>> Luciano de Souza
>>>
>>>
>>
>
>
> --
> Luciano de Souza
>


-- 
Luciano de Souza