0.1.8 • Published 11 years ago

lightcore v0.1.8

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

lightcore

Convention over Configuration, simplify your code.

For expressjs.

Install

npm install lightcore

Quick start

var core = require('lightcore');
core.app.get('/', function(req, res){
	res.send('Hello World!');
}); 
core.start(); //default port 8964

Libraries

  • Based Framework: expressjs core.app
  • Template: swig core.view

Databases

Currenttly support

  • sqlite3 (core.model.sqlite)
  • mysql (core.model.mysql)
  • mongodb(mongoskin) (core.model.mongodb)
  • redis (core.model.redis)

Using db by configure it just one time, of cause you must install Modules first.

{
    "models": {
        "sqlite": "data/rss.db",
        "mysql": {
            "host": "127.0.0.1"
        }
    }
}

and now you can use it by

var core = require('lightcore')
core.model.sqlite.get("SELECT 1,2,3", function(err, result){
	console.log(result);
});    

Configure

  • IMPORTANT * Your current work directory is the base directory

put your config.json under base directory lightcore will merge your configure,default config under lightcore root directory.

{	
	"port": 8964,
    "express": {
        "disable": ["x-powered-by"],
        "enable": ["trust proxy"]
    },
    "static": {
        "/statics": "statics",
        "/css": "statics/css",
        "/js": "statics/js",
        "/img": "statics/img"
    },
    "models": {
        "sqlite": "data/rss.db",
        "mysql": {
            "host": "127.0.0.1"
        }
    }        
}

items express: auto configure your express js static: your static files,key is request path,value is the directory's path

Licence

BSD

Link

http://www.shiguanglu.com

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago