-
Notifications
You must be signed in to change notification settings - Fork 0
Home
_DiSay edited this page Sep 25, 2022
·
14 revisions
Welcome to the Blomma wiki!
I recommend reading in this order:
We use gopher-lua as the Lua virtual machine. Perhaps you can use its functionality to write projects, but I do not guarantee 100% roboticity.
It is assumed that you already have Golang 1.18+ installed.
- Copy the repository.
$ git clone https://github.com/DiSay1/Blomma.git
- Go to the source folder.
$ cd Blomma
- Compiling sources.
-
$ go build -o .\bin\blomma.exe
or$ go build -o ./bin/blomma
if you are on Linux
- Go to the folder with the binary.
$ cd ./bin/
- Run the binary
-
$ .\blomma.exe
or$ ./blomma
if you are on Linux
- Go to config
- We find the item "dev_mode" there and set it to true.
dev_mode = true
[SSL]
cert_file = ""
key_file = ""
ssl = false
[server]
address = ""
port = 8080
- Reboot the server
- Press enter and enter the command from point 5 again
- Check if the
web
folder contains theindex.lua
file
- Its content should be like this:
-- Handler Options
options = {
Address = "/", -- Web path to handler
}
-- Function called on request
function Handler (request)
-- Outputting the values of the desired variable
request.write("Hello world!")
end
- If your server is running, go to the browser for the address shown when the server started. Usually this is
localhost:8080
- On the displayed page, you should have the word
Hello World
displayed
- Let's create another handler.
- In the folder
./web
create a filevalue.lua
- And put the following code in it:
-- Handler options
options = {
Address = "/value", -- Web path
}
-- Function called on HTTP request
function Handler (request)
-- Write values from Query parameters
local value = request.getQuery("value")
-- Displaying the values
request.write(value)
end
- Reboot the server, you already know how to do it
- If you have not closed the browser yet, open the path
http://localhost:8080/value?value=Dynamic Hello World
there
For more understanding, I recommend reading: Web & Static folder & Basic