0.0.6 • Published 9 years ago

waco v0.0.6

Weekly downloads
2
License
Apache
Repository
github
Last release
9 years ago

waco

Waco (Web App COmpiler) is a module for compiling a node server supporting basic CRUD operations on objects specified by a simple JSON model.

###The Configuration Object: The waco method generateServer takes one argument, a configuration object with the following properties:

####plugin The name of the node module implementing the waco database plugin you wish to use.

####pluginSettings Any key-value pairs specified and used by the database plugin module.

####dataModels The set of objects to represent in the database. The value of each object's properties should be meta-data specified and used by the database plugin you plan to use.

###Example usage: This example generates a nodejs web server with a mysql database for storing licencse plate information. The dataModels property specified what objects the database will store and what properties each object has. Because we are using the waco-mysql plugin which implements a mysql database, our object-property meta-data is the MySQL column type for that property. The waco-mysql module used here is built on to of felixge/node-myql, so thepluginSettings properties are forwared to that module when the server code is generated.

This is the entirety of the code the developer needs to write in order to generate a fully functional CRUD server supporting a RESTful interface.

var waco = require('waco');

var config = {
    plugin: "waco-mysql",               // The database backend to use (npm install waco-mysql)
    pluginSettings:  {                  // Database plugin required settings
        host:     "example.com",
        user:     "user",
        password: "pass",
        port:     "3001"    
    },
    dataModels: {                       // The database models
        license: {                      // example: data model for a license plate
            number: "INT",              // example: license plate feature.
            owner: "TEXT",              //          INT and TEXT are meta-data that
            vehicle: "TEXT",            //          the database plugin might use. 
            expDate: "INT"
        },
        user: {                      
            name: "TEXT",
            pass: "TEXT",
        }
    }
};

waco.generateServer(config);            // Generate the web server
0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago