sateffen / nodgine

The nodgine is a small framework for creating fast webservices. The main focuses are speed and easiness.
MIT License
0 stars 0 forks source link

Configurable via json #13

Closed sateffen closed 10 years ago

sateffen commented 10 years ago

Maybe there should be an possibility configure the whole process via a json file. Currently the main javascript file is simply a file, that calls hundred times addRoute, hundred times registerService, finally startHTTP and then run. This gets pretty unreadable. A json file would be better.

sateffen commented 10 years ago

The JSON will look like:

{
    basepath: 'path/where/everything/is'
    routes: [
        {
            route: '/route/:id?',
            controller: 'path/to/controller'
            caseSensetive: false
        }
    ],
    services: [
        {
            id: 'id',
            type: 'type',
            controller: 'path/to/controller'
        }
    ],
    preprocessors: [
        '/path/to/preprocessor'
    ],
    postprocessors: [
    ],
    loadpaths: [
        'path1'
    ],
    http: {
        port: 80
    },
    https: {
        port: 443,
        cert: 'cert',
        key: 'key',
        options: {}
    }
}

Even though this is a javascript object, image it's valid JSON

sateffen commented 10 years ago

I added a test for the global nodgine functions, so for this feature, too. The tests are going well, so the feature itself can be used, but needs some documentation in the wiki. If the unittest is finished as well, I'll close this feature-ticket, and release the next version of the nodgine.

sateffen commented 10 years ago

I guess this feature is now implemented. Every test I've done worked. If you find a bug, send me an issue report