module.exports = exports = {

    prefix: '/db_api/v1',

    middleware: [
        // JWT authorization middleware. Sets req.user and req.token.
        // Second param is array of required grants.
        ['api:auth:BearerToken', ['database']],
    ],

    get: {
        '/': [ 'controller::api:v1:DatabaseAPI.databases' ],

        '/:database_id': [
            'middleware::api:DatabaseRoute',
            'controller::api:v1:DatabaseAPI.get_database',
        ],

        '/:database_id/columns': [
            'middleware::api:DatabaseRoute',
            'controller::api:v1:DatabaseAPI.get_columns',
        ],

        '/:database_id/columns/order': [
            'middleware::api:DatabaseRoute',
            'controller::api:v1:DatabaseAPI.get_columns_order',
        ],

        '/:database_id/data': [
            'middleware::api:DatabaseRoute',
            'controller::api:v1:DatabaseAPI.get_data',
        ],

        '/:database_id/record/:record_id': [
            'middleware::api:DatabaseRoute',
            'controller::api:v1:DatabaseAPI.get_record',
        ],
    },

    post: {

    },
}
