river-of-ebooks/config/routes.js

109 lines
4.7 KiB
JavaScript
Raw Normal View History

2018-10-16 01:45:37 +00:00
/**
* Route Mappings
* (sails.config.routes)
*
* Your routes tell Sails what to do each time it receives a request.
*
* For more information on configuring custom routes, check out:
* https://sailsjs.com/anatomy/config/routes-js
*/
module.exports.routes = {
// ╦ ╦╔═╗╔╗ ╔═╗╔═╗╔═╗╔═╗╔═╗
// ║║║║╣ ╠╩╗╠═╝╠═╣║ ╦║╣ ╚═╗
// ╚╩╝╚═╝╚═╝╩ ╩ ╩╚═╝╚═╝╚═╝
/***************************************************************************
* *
* Make the view located at `views/homepage.ejs` your home page. *
* *
* (Alternatively, remove this and add an `index.html` file in your *
* `assets` directory) *
* *
***************************************************************************/
2019-03-13 16:55:35 +00:00
'GET /': 'HomeController.show',
'GET /docs/:page': 'HomeController.docs',
2018-11-02 00:21:36 +00:00
'GET /login': {
2018-10-28 22:12:48 +00:00
view: 'pages/login'
},
2018-11-02 00:21:36 +00:00
'GET /register': {
2018-10-29 22:39:29 +00:00
view: 'pages/login'
},
2019-02-04 21:08:45 +00:00
// figure out why proper clientside routing breaks the backend session
'GET /account': 'TargetController.show',
'GET /targets': 'TargetController.show',
'GET /keys': 'TargetController.show',
'GET /admin': 'AdminController.show',
'GET /admin/*': {
action: 'admin/show',
skipAssets: true
},
2018-10-16 01:45:37 +00:00
/***************************************************************************
* *
* More custom routes here... *
* (See https://sailsjs.com/config/routes for examples.) *
* *
* If a request to a URL doesn't match any of the routes in this file, it *
* is matched against "shadow routes" (e.g. blueprint routes). If it does *
* not match any of those, it is matched against static assets. *
* *
***************************************************************************/
// ╔═╗╔═╗╦ ╔═╗╔╗╔╔╦╗╔═╗╔═╗╦╔╗╔╔╦╗╔═╗
// ╠═╣╠═╝║ ║╣ ║║║ ║║╠═╝║ ║║║║║ ║ ╚═╗
// ╩ ╩╩ ╩ ╚═╝╝╚╝═╩╝╩ ╚═╝╩╝╚╝ ╩ ╚═╝
2018-11-02 00:21:36 +00:00
'POST /register': 'UserController.create',
'GET /logout': 'AuthController.logout',
2018-10-16 01:45:37 +00:00
2018-11-02 00:21:36 +00:00
'POST /auth/email_exists': 'AuthController.emailExists',
'POST /auth/email_available': 'AuthController.emailAvailable',
2019-03-05 20:39:07 +00:00
2019-02-04 21:08:45 +00:00
'GET /api/me': 'UserController.me',
'PATCH /api/me': 'UserController.edit',
2019-03-05 23:55:31 +00:00
'PATCH /api/me/regenerate_signing_secret': 'UserController.regenerateSigningSecret',
2018-11-02 00:21:36 +00:00
'POST /auth/:provider': 'AuthController.callback',
'POST /auth/:provider/:action': 'AuthController.callback',
'GET /auth/:provider': 'AuthController.provider',
'GET /auth/:provider/callback': 'AuthController.callback',
'GET /auth/:provider/:action': 'AuthController.callback',
'POST /api/publish': 'BooksController.publish',
2018-11-15 03:51:29 +00:00
2019-03-05 20:39:07 +00:00
'GET /api/catalog': 'CatalogController.navigation',
'GET /api/catalog/new': 'CatalogController.listNew',
'GET /api/catalog/all': 'CatalogController.listAll',
2018-11-15 03:51:29 +00:00
'POST /api/targets': 'TargetController.create',
'GET /api/targets': 'TargetController.list',
2018-11-15 03:51:29 +00:00
'PATCH /api/targets/:id': 'TargetController.edit',
'DELETE /api/targets/:id': 'TargetController.delete',
'POST /api/keys': 'PublishKeyController.create',
'GET /api/keys': 'PublishKeyController.list',
'PATCH /api/keys/:id': 'PublishKeyController.refresh',
'DELETE /api/keys/:id': 'PublishKeyController.delete',
2019-02-26 22:17:30 +00:00
'POST /api/keys/:id/verify': 'PublishKeyController.verify',
'GET /admin/api/users': 'AdminController.listUsers',
2019-02-26 03:29:18 +00:00
'GET /admin/api/publishers': 'AdminController.listPublishers',
'PATCH /admin/api/users/:id': 'AdminController.editUser',
'PATCH /admin/api/publishers/:id': 'AdminController.editPublisher',
'DELETE /admin/api/users/:id': 'AdminController.deleteUser',
'DELETE /admin/api/publishers/:id': 'AdminController.deletePublisher'
2018-10-16 01:45:37 +00:00
// ╦ ╦╔═╗╔╗ ╦ ╦╔═╗╔═╗╦╔═╔═╗
// ║║║║╣ ╠╩╗╠═╣║ ║║ ║╠╩╗╚═╗
// ╚╩╝╚═╝╚═╝╩ ╩╚═╝╚═╝╩ ╩╚═╝
// ╔╦╗╦╔═╗╔═╗
// ║║║║╚═╗║
// ╩ ╩╩╚═╝╚═╝
2018-11-07 20:06:36 +00:00
}