PureBasic Server Pages - possible?

Everything else that doesn't fall into one of the other PB categories.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

PureBasic Server Pages - possible?

Post by es_91 »

I have no idea.

My question is if it is possible to create an object oriented language to be bound into an html code to create server-side scriptcode in PureBasic. This is like ASP or JSP. I would like to have something like that because it really suxx to write code in Java and Visual Basic... imo is not a real Basic.

After all, PureBasic code could easily be wrapped into OOP, for example ...

Code: Select all

  Window = OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, 640, 480, "MyWindow", #PB_Window_SystemMenu|#PB_Window_Invisible)
  HideWindow(Window, #False)
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        End
    EndSelect
  ForEver
... could be translated into ...

Code: Select all

  Declare Window_Close()
  
  Window = New PureBasic.Window()
  Window.ID = #PB_Any
  Window.X = #PB_Ignore
  Window.Y = #PB_Ignore
  Window.Width = 640
  Window.Height = 480
  Window.Title$ = "MyWindow"
  Window.Flags = #PB_Window_SystemMenu|#PB_Window_Invisible
  Window.Create()
  Window.Hide(#False)
  
  Window.WindowEvents.CloseWindow = @Window_Close()
  
  Procedure Window_Close()
    End
  EndProcedure
.

What do you think?
:mrgreen:
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8453
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: PureBasic Server Pages - possible?

Post by netmaestro »

Would cgi serve your purpose? I believe Paul has a cgi library and others here (rings, infratec off the top of my head) have experience implementing cgi in PureBasic. For server side scripting, that would seem your best bet.
BERESHEIT
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: PureBasic Server Pages - possible?

Post by es_91 »

Well... yeah. I will try that. But what i had in mind, it now gets clear to me, was an own web server serving PureBasic support. As far as i understand cgi does use standart web serving technology, alowing to bind in several languages. (So, is it possible to use freeBasic with cgi? I'd have to read about stdout and stdin as well as environment variables, i understand.) But what i wanted was a real PureBasic support. Like that:

Code: Select all

<HTML>
  <HEAD>
  </HEAD>
  <BODY>
    <$ Page.PrintN("The time is: "+FormatDate("%hh:%ii:%ss", Date())) $>
  </BODY>
</HTML>
... giving ...

Code: Select all

<HTML>
  <HEAD>
  </HEAD>
  <BODY>
    <p>
      The time is: 21:43:25
    </p>
  </BODY>
</HTML>
CGI is slow, right? So an own web server would be better or am i underestimating the efforts needed to create a fully usable own web server?
:mrgreen:
User avatar
the.weavster
Addict
Addict
Posts: 1583
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: PureBasic Server Pages - possible?

Post by the.weavster »

Check out nodejs for the server, it's hard to beat, both for ease and performance.

Wherever possible I'd recommend creating a single page web app and a remote procedure call server that pass JSON back and forth rather than embedding scripts in HTML.
Post Reply