cozy / cozy-template-coffee

Template project for Cozy Applications written with Coffeescript
cozy.io
Other
10 stars 7 forks source link

Server config file: correct model ? #21

Open jbinard opened 8 years ago

jbinard commented 8 years ago

The server config file doesn't follow the same model as the official cozy cloud applications (checked on e-mail, photos and calendar). Is it normal ?

For example, in the tempate, you have :

config =
    common: [
        americano.bodyParser()
        americano.methodOverride()
        americano.errorHandler
            dumpExceptions: true
            showStack: true
        americano.static __dirname + '/../client/public',
            maxAge: 86400000
    ]

    development: [
        americano.logger 'dev'
    ]

    production: [
        americano.logger 'short'
    ]

    plugins: [
        'cozydb'
]

module.exports = config

In the official apps, you have:

module.exports =

    common:
        use: [
            staticMiddleware
            publicStatic
            americano.bodyParser keepExtensions: true
        ]
        useAfter: [
            americano.errorHandler
                dumpExceptions: true
                showStack: true
        ]
        set:
            views: viewsDir
            'view engine': if useBuildView then 'js' else 'jade'

        engine:
            js: (path, locales, callback) ->
                callback null, require(path)(locales)

    development: [
        americano.logger 'dev'
    ]

    production: [
        americano.logger 'short'
    ]

    plugins: [
        'cozydb'
]
jsilvestre commented 8 years ago

Hey @jbinard,

Thank you for your report, you are right.the set/engine part are specific to technology we use, but not specific to Cozy itself. The rest should be changed because the way Express works has changed (error handler must be declared after the server starts). I can't change it right now, will do whenever I can. If you'd like to contribute, feel free to open a PR and I'll merge it!

Cheers, Joseph.