JSEXT

JSEXT is a framework for writing programs in JavaScript. It is intended for use in three scenarios:

Some features: Tools for effortless inclusion of existing libraries written in C. Support for fastcgi, which connects to Apache, IIS and lighttpd. Also supports CGI. Support for MySQL, SQLite, FTP, SMTP and HTTP. Support for AJAX, JSON, SOAP and WSDL. Runs on Linux. Previous versions have been Windows compatible, but the latest versions have not been back-ported for a while.

New in version 1.1

Support for PostgreSQL, Sessions, multiple-choice form fields, x86_64 and other processsors, zlib and bitfields in C apis.

JavaScript as a server-side language

A number of dynamically typed, interpreted languages with garbage collection have become popular for scripting websites and other server-side tasks. On the list is Perl, PHP, Python and Ruby. JavaScript has largely been overlooked for this purpose even though it is a well-known language in the same category. The purpose of this site is to pull together the code needed to make JavaScript an alternative on par with the most popular server-side scripting languages. The current trend with AJAX is to do more scripting on the client. The only choice is JavaScript, since that's the only language all browsers understand. Using the same language on both server and client has some obvious benefits.

The core language, although universally misunderstood, is elegant, simple, yet powerful. It has an international standard (ECMAscript), plenty of documentation (Microsoft, Mozilla, O'Reilly) and open-source implementations (SpiderMonkey, Rhino).

Documentation

This site contains the following articles on JSEXT:

Download

Source code, .deb and .rpm packages:

Example: C integration

// inc.h



#include <sys/utsname.h>


#pragma JSEXT dl main // C library already linked.

// uname.js



#!/usr/bin/jsext


function
 () {
  
var
 

buf

 = 
new
 

Pointer

(

inc

[

'struct utsname'

]);
  

inc

.

uname

(

buf

);
  

buf

 = 

buf

.

$

// dereference pointer to struct


  

print

(

buf

.

sysname

"\n"

);
  

// allocated memory will be freed automatically during garbage collection


}

// output:


Linux

Example: Send an email

// sendMail.js



#!/usr/bin/jsext


function
() {
  

JSEXT1

.

write

(

"mailto:john.doe@example.com?subject=hi"

,
               

"smtp.example.com"

,
               

"Hello, John!"

);
}

More Examples.

Contact

You can reach me at these addresses. Feature requests can be discussed at its own page. There is also a mailing list (with archive), which you can join by sending any message to jsext-forum-join@lists.sourceforge.net. Further information is available at the sourceforge project pages.

License

JSEXT is based on SpiderMonkey. SpiderMonkey is licensed under a triple license. You choose whether to use it under the Mozilla public license, LGPL or GPL. JSEXT itself is released under the BSD license.


Comments


2008/06/13 19:03:04 GMT

Absolutely awesome. I installed the deb and got some examples working with lighttpd and CGI "out of the box". The fastcgi interface bombed out but I suspect I need to compile from source for this particular distro (Debian testing). Fantastic effort for a first release and I'm looking forward to exploring the docs and examples to see if everything actually works, if it does I'll be over the moon. Thank you for creating and releasing this project :-)

--markc


2008/06/14 17:01:04 GMT

Glad you like it :-) If fcgi doesn't work, one explanation may be that your system is missing libfcgi.so.0, which should be installed from a package like libfcgi0ldbl.

/sb


2008/06/19 08:13:29 GMT

no postgresql support? MySQL and SQLite are rather lightweight databases.

James


2008/06/26 23:25:33 GMT

Postgresql will be supported in version 1.1, which will be released shortly.

/sb


2008/06/27 12:45:59 GMT

Many thanks for such a great tool. Are there plans for adding some bitfields support? The first c library I was trying to use was hamlib and it does use bitfields :-(. JSEXT doesn't produce any warning, it just make invalid struct declaration and then all pointers became a total mess. May it will be better to just throw error and force user to specify such bitfields manually?

//gvv


2008/06/27 17:17:47 GMT

Version 1.1 will have support for bitfields, thanks to your question.

/sb


2008/06/27 21:22:13 GMT

Thanks for great news!

Another question about spidermonkey version. JSEXT uses 1.6. Version 1.7 introduces generators. And version 1.8 has some nice language additions too. In our project we already with just a little migration issues. Do you have plans to upgrade spidermonkey?

Generators are avesome to do asynchronous IO, check this Neil Mix Thread class - http://www.neilmix.com/2007/02/07/threading-in-javascript-17/. Together with select/poll approach to io they provide nice framework for concurrent IO. Together with postgresql async io support it is possible to implement the whole web-framework (http, files and database) in JS without going to native threads.

//gvv


2008/06/28 07:50:21 GMT

I've had some trouble with 1.7, even after fixing the small api changes. I will get back to it eventually, but maybe not for version 1.1.

/sb


2008/06/28 15:35:36 GMT

Amazing, I'm really surprised about your work. I'd like to use it as my default technology, but I have a problem, In my AMD64 Debian box I get some errors at compile time, something is wrong with the -fPIC option while compiling the JSEst module.

What do you suggest me? Do you have a deb package for x64 systems?

Lucio Nunez. Guadalajara, Jalisco, Mexico.


2008/06/29 00:00:46 GMT

Many people have asked for support for x86_64. I am happy to say that this processor will be supported in version 1.1. All machine-specific parts have been moved to libffi, which supports a long list of processors. I'll release it sometime this coming week. (If you're in a hurry, the svn repository is up-to-date)

/sb


2008/07/07 08:49:46 GMT

Great work! What about the window version?


2008/07/07 13:09:13 GMT

I'll consider it after the summer holidays. If someone wants to have a go at it, the source code contains .sln and .bat files, the remnants of an old Windows build which just needs some grease and fresh paint.

/sb


2008/07/23 07:30:42 GMT

When do the summer holidays end? :)

-Eric Bloch


2008/07/24 10:34:48 GMT

:-) Check back towards the end of August. In the meanwhile, I've created a page for discussions regarding Feature requests

/sb


2008/07/30 04:49:44 GMT

Posted a comment about the question above in SQLite wiki page. I think we may post general questions here instead of populate this page with particular questions.

Lucio Nunez.


2008/08/04 20:17:20 GMT

So where do particular questions about basic functionality go? I'm trying to get JSExt running but haven't had much luck with anything. I came back after the weekend and found all my scripts erroring with this: Line 133 in /usr/lib/jsext/JSEXT1/http/execScript.js:TypeError: curdir has no properties call([object Object],undefined)@:0 (undefined)@/usr/lib/jsext/JSEXT1/cgi.js:182 Any ideas? /Alex Yule


2008/08/04 20:28:09 GMT

This error message reminds me of trouble I had with SpiderMonkey 1.7. For now, JSEXT only supports SpiderMonkey 1.6.

/sb


2008/08/05 23:02:42 GMT

I'm on Fedora 8 and I've installed the rpm version, when in type jsext at the prompt I get:

Unknown file:uncaught exception: Unable to open dl libcdb.so.1: cannot open shared object file: No such file or

YC


2008/08/06 18:30:32 GMT

The rpm package is automatically converted from the deb package, and therefore lacks dependency lists. You need to find out which package can provide the missing file and install it. The dependencies are: libcdb1, libffi4 and optionally libreadline5, libsqlite3-0, libmysqlclient15off, libfcgi0ldbl, zlib1g, libpq5, libcairo2 (depending on which libraries you want to use). However, package names may differ between distributions.

/sb


2008/08/07 21:58:15 GMT

I spent a weekend immersed in client-side JavaScript, only to come into work on Monday obsessed with developing JS on the server-side. JSEXT is the easiest to deploy, most comprehensive and simply brilliant option I've found. Cheers, I plan on using JSEXT in some small projects, but I am really, really jazzed about what you've got going here.


2008/08/15 08:24:54 GMT

I have problems to compile it on OSX. Anyone tried it before?


2008/08/22 04:16:17 GMT

Has anyone got any simple open source examples they would care to share?

And/or is there any interest in a repository of JSEXT code?

--markc


2008/08/27 20:35:09 GMT

Hello, I'm creating an entire framework for websites, it's focused on intranet webapps, but I think it's easily customizable, I'm also creating a PDF library that will help to create PDFs on the fly in a simple way. I think all of this will be ready by september first week. I will share it.

lucio nunez/lucas


2008/09/08 19:29:21 GMT

Is it posible to get a windows build? I'm really looking for an alternative to ruby/python!


2008/09/08 20:12:31 GMT

If enough people ask for a Windows port, it may eventually happen, and even more so if someone lends a helping hand. There has been some movement on the OSX port, so that may happen first.

/sb


SourceForge.net Logo