Mostrando entradas con la etiqueta javascript. Mostrar todas las entradas
Mostrando entradas con la etiqueta javascript. Mostrar todas las entradas

Jongo as a JavaScript Application Server

Jongo is built on top of the Jetty webserver, allowing a developer to use only one server to build a full application using static content (html, css, images) and JavaScript. For Jongo to be able to deploy your application, you need to activate the jongo.allow.apps option in the jongo.properties file.

Continue and create a folder in your JONGO_HOME named apps/myapp and develop you application there, something like this:

An example of a MVC ExtJS Application
If everything went fine, the next time you run jongo, you'll see this in your logs (if debug mode is enabled):


2011-12-05 22:02:04 o.j.JongoJetty [DEBUG] Loading apps
2011-12-05 22:02:04 o.j.JongoJetty [DEBUG] Creating Servlet for myapp

Now navigate to http://jongo-server:port/myapp/ and your application should work.

Jongo and ExtJS

To work out some issues other developers might have when working with Jongo, I've started to develop a  JavaScript only application (pretty much like the Administration Console) and get some insights into using  a great JavaScript framework named ExtJS.

ExtJS provides a clean MVC framework which fits perfectly with a Jongo back-end.

By using a rest proxy like this:



Ext.define('User', {
    extend: 'Ext.data.Model',
    fields: ['id', 'name', 'email']
});

Ext.define('Users', {
    extend: 'Ext.data.Store',
    model: 'User',
    proxy: {
        type: 'rest',
        url : '/jongo/user',
        reader: {
            type: 'json',
            success: true,
            root: 'response'
        }
    }
});


Our application is ready to perform all rest operations on the database without doing any server-side coding. Give it a try, you'll be pleased.

CoffeeScript in 1, 2, 3...

Ok, this is very easy, but nowhere to be found on the CoffeeScript site and shows how easy it's to get started.
I mean, really, why? If you're going to develop on Javascript, you don't want to "build" your code.
So, all you need is some simple HTML and the following:
<script src="coffee-script.js"></script>
<script type="text/coffeescript">
     alert "Hello CoffeeScript!"
</script>
Now add the "coffee-script.js" file in your path, and open it with your browser. No servers, no compilers, no NodeJS and nothing to install.