backend/app/routing/routers/api/v1.routes.js
2020-02-09 17:09:10 -06:00

80 lines
3.3 KiB
JavaScript

/*
* API v1 Routes
* -------------------------------------------------------------
* Description here
*/
const index = {
/*
* Define the prefix applied to each of these routes.
* For example, if prefix is '/auth':
* '/' becomes '/auth'
* '/login' becomes '/auth/login'
*/
prefix: '/api/v1',
/*
* Define middleware that should be applied to all
* routes defined in this file. Middleware should be
* included using its non-prefixed canonical name.
*
* You can pass arguments along to a middleware by
* specifying it as an array where the first element
* is the canonical name of the middleware and the
* second element is the argument passed to the
* handler's exec() method.
*/
middleware: [
'auth:UserOnly',
],
/*
* Define GET routes.
* These routes are registered as GET methods.
* Handlers for these routes should be specified as
* an array of canonical references to controller methods
* or middleware that are applied in order.
*/
get: {
'/files/:PageId/:NodeId/get/:FilesId': ['controller::api:v1:File.get_config'],
'/files/:PageId/:NodeId/get/:FilesId/:FileId': ['controller::api:v1:File.download'],
'/hello_world': ['controller::api:v1:Misc.hello_world'],
'/page/:PageId': ['controller::api:v1:Page.get_page'],
'/page/:PageId/nodes': ['controller::api:v1:Page.get_nodes'],
'/menu/items': ['controller::api:v1:Menu.get_items'],
'/db/:PageId/:NodeId/get/:DatabaseId': ['controller::api:v1:FormDatabase.get_config'],
'/db/:PageId/:NodeId/get/:DatabaseId/columns': [ 'controller::api:v1:FormDatabase.get_columns' ],
'/db/:PageId/:NodeId/get/:DatabaseId/data': [ 'controller::api:v1:FormDatabase.get_data' ],
'/code/:PageId/:NodeId/get/:CodiumId': ['controller::api:v1:FormCode.get_config'],
'/data/export/html': ['controller::Export.html_export'],
},
post: {
'/file/upload/:PageId/:NodeId/:FilesId': ['middleware::upload:UploadFile', 'controller::api:v1:File.save_upload'],
'/files/:PageId/:NodeId/create': ['controller::api:v1:File.create_config'],
'/files/:PageId/:NodeId/delete/:FilesId': ['controller::api:v1:File.delete_group'],
'/page/:PageId/save': ['controller::api:v1:Page.save_page'],
'/page/:PageId/nodes/save': ['controller::api:v1:Page.save_nodes'],
'/page/create': ['controller::api:v1:Page.create_top_level'],
'/page/create-child': ['controller::api:v1:Page.create_child'],
'/page/delete/:PageId': ['controller::api:v1:Page.delete_page'],
'/db/:PageId/:NodeId/create': ['controller::api:v1:FormDatabase.create_new'],
'/db/:PageId/:NodeId/set/:DatabaseId/columns': [ 'controller::api:v1:FormDatabase.set_columns' ],
'/db/:PageId/:NodeId/drop/:DatabaseId': [ 'controller::api:v1:FormDatabase.drop_database' ],
'/db/:PageId/:NodeId/set/:DatabaseId/data': ['controller::api:v1:FormDatabase.set_data'],
'/code/:PageId/:NodeId/create': ['controller::api:v1:FormCode.create_new'],
'/code/:PageId/:NodeId/set/:CodiumId': ['controller::api:v1:FormCode.set_values'],
'/code/:PageId/:NodeId/delete/:CodiumId': ['controller::api:v1:FormCode.drop_code'],
},
}
module.exports = exports = index