Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New config design for ThinkJS 3.x #409

Closed
welefen opened this issue Aug 1, 2016 · 1 comment
Closed

New config design for ThinkJS 3.x #409

welefen opened this issue Aug 1, 2016 · 1 comment

Comments

@welefen
Copy link
Member

welefen commented Aug 1, 2016

New config design, more for adapter:

  • add common field, all common keys in common field
  • remove adapter field, use type directly
  • add handle field for adapter
  • can reassign type in adapter, thus support multi same type

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: () => {},
    }
}
@welefen welefen changed the title 新配置设计 New config design Oct 31, 2016
@welefen welefen changed the title New config design New config design for ThinkJS 3.x Oct 31, 2016
@ckken
Copy link
Contributor

ckken commented Dec 14, 2016

Agree!

@welefen welefen added the 3.x label Feb 8, 2017
@welefen welefen closed this as completed Aug 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants