Skip to content
_DiSay edited this page Sep 25, 2022 · 14 revisions

Welcome to the Blomma wiki!

I recommend reading in this order:

Getting start


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.

  1. Copy the repository.
  • $ git clone https://github.com/DiSay1/Blomma.git
  1. Go to the source folder.
  • $ cd Blomma
  1. Compiling sources.
  • $ go build -o .\bin\blomma.exe or $ go build -o ./bin/blomma if you are on Linux
  1. Go to the folder with the binary.
  • $ cd ./bin/
  1. Run the binary
  • $ .\blomma.exe or $ ./blomma if you are on Linux
  1. 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
  1. Reboot the server
  • Press enter and enter the command from point 5 again
  1. Check if the web folder contains the index.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
  1. 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 image
  1. Let's create another handler.
  • In the folder ./web create a file value.lua
  1. 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
  1. Reboot the server, you already know how to do it
  2. If you have not closed the browser yet, open the path http://localhost:8080/value?value=Dynamic Hello World there image

For more understanding, I recommend reading: Web & Static folder & Basic

Clone this wiki locally