Programming an easy Webserver

Hello I am an apprentice and got the task to program a webserver which outputs a “hello world” in http: localhost: arbitrary_port. As a beginner I don’t know much about it and therefore I ask for an approach. :smiley:

THX for Help

You can look in the examples folder, under internet ithought there was an example webserver project

What i find was an error page. ^^" No examples.

From Xojo: File - New Project - Click Examples icon on the left side of the ‘Choose a Project’ windows - then scroll down to Web.

Maybe the DialogsExample.xojo_binary_project will help

Take a look at this GitHub repository. A full fledged webserver.

School project?

It’s a project from my Company to improve my programming

In that case go with the GitHub one, work through the source code, and make some flow charts how it all connects.

[quote=369275:@Patrick Lämmer]Hello I am an apprentice and got the task to program a webserver which outputs a “hello world” in http: localhost: arbitrary_port. As a beginner I don’t know much about it and therefore I ask for an approach. :smiley:

THX for Help[/quote]

Check out AloeExpress. It’s open source: https://aloe.zone/ The demo does exactly that! :slight_smile:

Xanadu uses the prior version of Aloe: https://campsoftware.com/products/xanadu-for-xojo.php We plan to update Xanadu to use AloeExpress before the Xojo Developer Conference. :slight_smile:

I just need a “Hello World” to localhost plus any port i want to see it in the browser ^^"

On Mac that’s as easy as turning on Apache

Some names have changed but this might help:

http://www.macdevcenter.com/pub/a/mac/2004/11/19/realbasic.html

My task is writing a program in Xojo to do that @Tim Parnell :slight_smile:

[quote=369660:@Jason Parsley]Some names have changed but this might help:

http://www.macdevcenter.com/pub/a/mac/2004/11/19/realbasic.html[/quote]
This looks interesting maybe i can some things adapt

Also take a look at the simple web server example project included with Xojo:

Examples/Communication/Internet/Web Server

@Hal Gumbert Why is xojo.core.dictionary used in the demo 1?

Hi @Patrick Lämmer. I’m the developer of Aloe Express, and I’m happy to answer any questions about it.

What xojo.core.dictionary are you referring to in demo 1?

ehhhm new Question i used the Webserver example and need to get explained how this works

i tried to figure it out in my language (german)

Dim f As FolderItem
Dim i As Integer //schleifen variable
Dim Count As Integer
Dim pathChunk As String

// locate a file that we are hosting based off the path
f = rootDir
Count = CountFields(path, “/”)

For i = 2 To Count
pathChunk = NthField(path, “/”, i)
If pathChunk = “…” Then // move up a level
f = f.Parent
End
If pathChunk = “” And i = Count Then
pathChunk = “index.html”
End

pathChunk = ConvertURLString(pathChunk)
f = f.Child(pathChunk)
If f = Nil Or f.Exists = False Then
Return Nil
End If
Next

Return f

@Tim Dietrich in case that i am beginner and don’t really understand that i used the Webserver Example from Xojo but thanks :slight_smile:

Basically it’s taking the URL passed and converting it to a local file path, based on the web root…