httpserver

This object allows you to start/stop and manipulate the internal web server. This object is initialized automatically.

 

beasscript-logo-small

httpserver=command[=parameters]

 

Commands definition:

start[=port[=path]]

Start the http internal server; optionally you can specify the port and the root folder

The default port and path are 8080 and the "current program folder\httpserver"

 

Example to start the server at c:\webserver and port 8080:

httpserver=start=8080=c:\webserver

 

stop

Stop the http internal server

getstatus

The status of the internal server is returned into the variable "value"

 

Example:

httpserver=getstatus

if <value> n= 0 then

messagebox=Server is stopped

else

messagebox=Server is running

end if

getip

Return the server ip into the variable "value"

 

Example:

httpserver=getip

messagebox=<value> is the server ip

getport

Return the port number into the variable "value"

 

Example:

httpserver=getport

messagebox=<value> is the port number selected

restapi_password=password

Sets the password to allow you authenticate and use the beascript / REST API commands via web

 

Example:

httpserver=restapi_password=myRestPassword

httpserver=start=8080

 

Open your browser and go to http://localhost:8080/examples/example_beasscript_from_web.html

You can use "myRestPassword" to authenticate yourself