Hi,

the reasons why i did this:
1) i wanted to have a simple webserver to get my son involved in programming an online game, and he knows already a little bit javascript 2) my hobby is programming in c++ and javascript, but at work i have to code in c#, so i just wanted to have some fun :-)

i think its no a new idea, ive seen some webservers using javascript as backend language, but everything i found was to complicated to install/use or to complicated to port to a new hw-platform (i want to run it on my linksys-nslu2 with ftpd to my topfield hd-vcr to program the recordings via web).
and i like sqlite very much and no webserver i found had this combination.
if you look at my code, you see that i just use
*) sqlite
*) the javascript-engine from mozilla (very advanced: js v1.7 including xml support...), *) some glue code to access sqlite and a simple http server from js (only one file: gas.cpp)

the trick between js and sqlite is like yours: every sql statement executed returns a 2-dim array... one thing is maybe iteresting: the class "DBItem". its a kind of (very simple) or-mapper. it maps the properties of a javascript-object to the columns of a table. here is a code example:

   var db = new Database("user.sdb");
db.exec("create table if not exists user (id integer primary key autoincrement, name varchar unique, pwd varchar, test varchar)");
   var user = new DBItem(db, "user");
   user._name = "Guenter";
   user._pwd = "FooBar1234567890";
   user._test = "blubb";
   user.flush();
   var id = user._id;
   var user = new DBItem(db, "user", id);
   print("name="+user._name+"\n");
   //db.exec("delete from user where id="+id);

if you are still curious (or anyone else ?), i can send you the actual source by mail. :-)

btw: i had a look into your http-source: looks nice, but its maybe to complicated to implement my features like http-multipart-posts.

cu, gg





John Stanton schrieb:
The multi-threaded application/www server I described requires no threading involvement from the application programmer. That programmer uses SQL, HTML, Javascript and the application language we call MUV. Think about it, when you use Apache you don't have to be aware of its internal threading.

The only significant synchronisation element is to do with multiple users of Sqlite, and that is handled transparently to the application programmer.

What I was curious about was your statement that you used Javascript as a backend. Do you have a novel idea there? For example my application language will, inter alia, populate Javascript arrays from an SQL statement. Do you have any such features or something more ingenious? (I still cannot get access to your server).

My application server runs on Win98, Win2000/XP, Linux, AIX 4.2 and 5.3. The executive, fileserving, compression and CGI components are realised in less than 20K of code. HTML V2 is implemented.

There are some old fragments of this program at http://www.viacognis.com/muvm. If you are interested I can dig out the current code and let you have it.


Günter Greschenz wrote:
Hi,

normally i like multithreading, but in this case i like the simple approach (at least for rendering the pages), because as application programmer (the guy who will develop the apps in javascript) its much easier if you dont have to think about locks, racing conditions and other pitfalls. and the rendering itself is (depending on what you do, of course) fast enough for me (simple pages need <10ms !). I want to multithread the upload to the client after all work is done. in my current implementation the complete server is blocked until the download is finished. in my logfiles i have entries with 25 minutes (see "http://greschenz.dyndns.org/logsByTime.html";) !!! thats really unacceptable ! could you mail me some samples howto multithread portable (linux & win32) ?

cu, gg


John Stanton schrieb:

Gunter,

I recently wrote a multi-threaded portable web server in simpl ANSI C. It uses Win32 threads or pthreads. It caches threads and re-uses them on a most recently used basis. Efficiency is obtained by using TransmitFile (Win32) or sendfile (Unix).

The logic is simple for an efficient, multi-threaded www server.

An added bonus of mutli-threading is that it takes advantage of the ability of a browser to open multiple concurrent connections and persistent connections.

My WWW server is set up as an application server, with embedded Sqlite and an embedded byte-coded metalanguage used to define DHTML pages. An associated compiler produces the byte code. By using compiled byte code the overhead of interpreting a script-type language is avoided.

Günter Greschenz wrote:

Hi,

yes i know, the problem is, its single-threaded (because of protability), so if anyone starts a download with a slow connection, the server is blocked for other connections.. im still thinking about this problem... single-threading whle rendering th pages and multithreading for sending them to the clients, or maybe async socket writes (is this possible in linux ?) but i've seen (in the logs :-) a lot of people are interested. its funny to sit at the console at home and see the log messages when anyone comes by... at the moment its just an alpha-version... but if i have more time (or maybe anyone helps me) it will improve ! the server itself is an i386-linux at ~ 300mhz, so dont expect too much ...


Fred Williams schrieb:

What'ch got it running on, a 286? Tried three different times and got
tired waiting all three times :-(

Not going to stir much interest with response times like that!


-----Original Message-----
From: Günter Greschenz [mailto:[EMAIL PROTECTED]
Sent: Monday, October 09, 2006 12:04 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] new sqlite-based webserver


hi,

i dont know if anyone is interested in my new open source project...
i implemented a little webserver with javascript as backend-language
(1.7 from mozilla 2.0.rc1) and sqlite as datastorage (3.3.7)
the server is serving himself on "http://greschenz.dyndns.org"; :-)
the source can be downloaded at
"http://greschenz.dyndns.org/download/gas/";
its compilable with gcc(linux) and vs2005(win32)

please send me any comments / ideas...

cu, gg



--------------------------------------------------------------
---------------
To unsubscribe, send email to [EMAIL PROTECTED]
--------------------------------------------------------------
---------------





-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------







-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to