backend/app/routing/routers/api/v1.routes.js

101 lines
3.8 KiB
JavaScript
Raw Normal View History

2020-02-08 08:39:33 +00:00
/*
* API v1 Routes
* -------------------------------------------------------------
* Description here
*/
const index = {
prefix: '/api/v1',
middleware: [
'auth:UserOnly',
2020-02-08 08:39:33 +00:00
],
get: {
2020-03-01 21:37:52 +00:00
'/token': [
'controller::api:v1:Misc.get_token',
],
// Get the file ref node config for the specified file ref
2020-02-09 10:37:21 +00:00
'/files/:PageId/:NodeId/get/:FilesId': ['controller::api:v1:File.get_config'],
// Download the specified file ID from the specified file ref node
2020-02-09 10:37:21 +00:00
'/files/:PageId/:NodeId/get/:FilesId/:FileId': ['controller::api:v1:File.download'],
// Get the data for the specified page
'/page/:PageId': ['controller::api:v1:Page.get_page'],
// Get the nodes present on the specified page
'/page/:PageId/nodes': ['controller::api:v1:Page.get_nodes'],
// Get the user's menu tree
'/menu/items': ['controller::api:v1:Menu.get_items'],
// Get the database ref node config for the specified database
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/get/:DatabaseId': ['controller::api:v1:FormDatabase.get_config'],
// Get the column config records for the specified database
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/get/:DatabaseId/columns': [ 'controller::api:v1:FormDatabase.get_columns' ],
// Get the row records for the specified database
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/get/:DatabaseId/data': [ 'controller::api:v1:FormDatabase.get_data' ],
// Get the code ref node config for the specified code editor
'/code/:PageId/:NodeId/get/:CodiumId': ['controller::api:v1:FormCode.get_config'],
2020-02-09 23:09:10 +00:00
// Export the entire personal tree as HTML
2020-02-09 23:09:10 +00:00
'/data/export/html': ['controller::Export.html_export'],
2020-10-13 02:46:50 +00:00
'/search': ['controller::api:v1:Misc.get_search'],
2020-02-08 08:39:33 +00:00
},
post: {
// Upload the file in the 'uploaded_file' key to the specified file ref node
2020-02-09 10:37:21 +00:00
'/file/upload/:PageId/:NodeId/:FilesId': ['middleware::upload:UploadFile', 'controller::api:v1:File.save_upload'],
// Create a new file ref node
2020-02-09 10:37:21 +00:00
'/files/:PageId/:NodeId/create': ['controller::api:v1:File.create_config'],
// Delete a file ref node and its files
'/files/:PageId/:NodeId/delete/:FilesId': ['controller::api:v1:File.delete_group'],
2020-02-09 10:37:21 +00:00
// Save the data for the specified page
'/page/:PageId/save': ['controller::api:v1:Page.save_page'],
// Save the node data for the specified page
'/page/:PageId/nodes/save': ['controller::api:v1:Page.save_nodes'],
// Create a new page in the personal root
'/page/create': ['controller::api:v1:Page.create_top_level'],
// Create a new page as a child of the specified page
'/page/create-child': ['controller::api:v1:Page.create_child'],
// Delete the specified page
'/page/delete/:PageId': ['controller::api:v1:Page.delete_page'],
2020-02-09 05:09:18 +00:00
// Create a new database ref config
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/create': ['controller::api:v1:FormDatabase.create_new'],
// Set the column configs for a database ref
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/set/:DatabaseId/columns': [ 'controller::api:v1:FormDatabase.set_columns' ],
// Delete the specified database ref
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/drop/:DatabaseId': [ 'controller::api:v1:FormDatabase.drop_database' ],
// Set the row data for the specified database ref
2020-02-09 05:09:18 +00:00
'/db/:PageId/:NodeId/set/:DatabaseId/data': ['controller::api:v1:FormDatabase.set_data'],
// Create a new code ref config
'/code/:PageId/:NodeId/create': ['controller::api:v1:FormCode.create_new'],
// Set the data for the specified code ref
'/code/:PageId/:NodeId/set/:CodiumId': ['controller::api:v1:FormCode.set_values'],
// delete the specified code ref
'/code/:PageId/:NodeId/delete/:CodiumId': ['controller::api:v1:FormCode.drop_code'],
2020-02-08 08:39:33 +00:00
},
}
module.exports = exports = index