thinkjs / thinkjs

Use full ES2015+ features to develop Node.js applications, Support TypeScript.
https://thinkjs.org/
MIT License
5.31k stars 617 forks source link

New config design for ThinkJS 3.x #409

Closed welefen closed 7 years ago

welefen commented 8 years ago

New config design, more for adapter:

database

const mysql = require('think-mysql');

{
    type: 'mysql',
    common: { // common fields
        logConnect: true,
        logSql: true
    },
    mysql: {
        host: '127.0.0.1',
        username: 'www',
        password: ''
        parser: (options) => {}
    },
    mysql2: {
        host: '10.0.1.1',
        username: 'www',
        password: ''
    },
    mongo: {

    }
}

template


const jade = require('think-view-jade');
const nunjucks = require('think-view-nunjucks');

{
    type: 'nunjucks',
    common: {
        extname: '.html',
        fileDep: '/'
    },
    jade: {
        handle: jade  // jade handler
    },
    nunjucks: {
        handle: nunjucks,
        prerender: () => {},
    }
}
ckken commented 7 years ago

Agree!