Comparing version 0.0.3 to 0.0.4
59
index.js
@@ -1,5 +0,8 @@ | ||
exports.attack = function(srv, config){ | ||
exports.attack = function(config){ | ||
// ====================================================== | ||
// prepare attack | ||
var express = require('express') | ||
, srv = express() | ||
fs = require('fs') | ||
@@ -10,4 +13,24 @@ mustache = require('mustache') | ||
Object.extend() | ||
var express = require('express') | ||
// ====================================================== | ||
// configure server | ||
config.viewRoot = config.root+'/node_modules/10tcl/lib/view' | ||
config.publicRoot = config.root+'/node_modules/10tcl/lib/public' | ||
srv.configure(function(){ | ||
srv.set('view engine', 'jade') | ||
srv.set('views', config.root + '/views') | ||
srv.use(express.favicon()) | ||
srv.use(express.logger()) | ||
srv.use(express.bodyParser()) | ||
srv.use(express.methodOverride()) | ||
srv.use(require('less-middleware')({ src: config.root + '/public' })) | ||
srv.use(express.static( config.publicRoot )) | ||
srv.use(express.cookieParser()) | ||
srv.use(express.session(config.session)) | ||
srv.use(srv.router) | ||
}) | ||
// ====================================================== | ||
@@ -17,4 +40,4 @@ // db | ||
, conStr = 'mongodb://{usr}:{pwd}@{srv}/{db}?{par}'.assign(config.db) | ||
srv.db = mongo.db(conStr) | ||
srv.db = mongo.db(conStr) | ||
@@ -29,19 +52,15 @@ // ====================================================== | ||
config.viewRoot = config.root+'/node_modules/10tcl/lib/view' | ||
config.publicRoot = config.root+'/node_modules/10tcl/lib/public' | ||
srv.use(express.static( config.publicRoot )) | ||
srv.get ( '/' , base.auth, base.idx ) | ||
srv.post( '/login' , base.login ) | ||
ctrls.forEach(function(file){ | ||
if (file.endsWith('.js')){ | ||
var controller_path = '{1}/{2}'.assign(pathToCtrls, file) | ||
menuItem = require(controller_path)(srv, base, config) | ||
menuItems.push(menuItem) | ||
} | ||
}) | ||
require('./lib/ctrl/ctrlAutoComplete')(srv, base, config) | ||
srv.post( '/login' , base.login ) | ||
ctrls.forEach(function(file){ | ||
if (file.endsWith('.js')){ | ||
var controller_path = '{1}/{2}'.assign(pathToCtrls, file) | ||
menuItem = require(controller_path)(srv, base, config) | ||
menuItems.push(menuItem) | ||
} | ||
}) | ||
require('./lib/ctrl/ctrlAutoComplete')(srv, base, config) | ||
// ====================================================== | ||
// ====================================================== | ||
// model | ||
@@ -72,2 +91,4 @@ var pathToModels = (config.pathToModels) ? config.root+config.pathToModels : config.root+'/models' | ||
}) | ||
return srv | ||
} |
{ | ||
"name": "10tcl", | ||
"description": "CRUD over express and mongodb", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Fernando Becker", |
@@ -8,4 +8,4 @@ ## What is it? | ||
It works! ...mostly. | ||
Right now I could not recommend it. Give it a few month before serious usage. | ||
It has some limitations and misconceptions that need fixing. | ||
Right now I could not recommend it. Give it a few months before serious usage. | ||
It has some limitations and misconceptions, and it is not getting better soon. | ||
@@ -40,19 +40,10 @@ ## Install | ||
step 1: create your express app | ||
var express = require('express') | ||
, app = express() | ||
var app = require('10tcl').attack(config) | ||
app.listen(yourPortHere) | ||
step 2: attack it! | ||
config = {...} | ||
require('10tcl').attack(app, config) | ||
10tcl attack results in an express app configured with routes based on your models and controllers. | ||
step 3: run away from it. | ||
10tcl just went over your models and controllers | ||
### Database | ||
Now app.db contains an connection to your database. | ||
app.db contains a connection to your database. | ||
It was done by using Mongoskin and the credentials on the config object. | ||
@@ -118,4 +109,4 @@ | ||
The views are made, with bootstrap, jquery, and some self-made binding (Angular was just making me angry). | ||
The views are made with bootstrap, jquery, and some self-made binding (Angular was just making me angry). | ||
In mobile they are much simpler, made with jquerymobile and jquery. | ||
The decision between mobile and desktop is made by reading request headers. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1437258
30028
109