mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-service.git
synced 2026-09-21 16:52:03 -07:00
51 lines
925 B
JavaScript
51 lines
925 B
JavaScript
const VALIDATOR = require('../../middleware/validators')
|
|||
|
|
const validator = new VALIDATOR()
|
||
|
|
|
||
|
|
const CONTROLLER = require('./controller')
|
||
|
|
const controller = new CONTROLLER()
|
||
|
|
|
||
|
|
// export const baseUrl = '/users'
|
||
|
|
module.exports.baseUrl = '/users'
|
||
|
|
|
||
|
|
module.exports.routes = [
|
||
|
|
{
|
||
|
|
method: 'POST',
|
||
|
|
route: '/',
|
||
|
|
handlers: [controller.createUser]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
method: 'GET',
|
||
|
|
route: '/',
|
||
|
|
handlers: [
|
||
|
|
validator.ensureUser,
|
||
|
|
controller.getUsers
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
method: 'GET',
|
||
|
|
route: '/:id',
|
||
|
|
handlers: [
|
||
|
|
validator.ensureUser,
|
||
|
|
controller.getUser
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
method: 'PUT',
|
||
|
|
route: '/:id',
|
||
|
|
handlers: [
|
||
|
|
validator.ensureTargetUserOrAdmin,
|
||
|
|
controller.getUser,
|
||
|
|
controller.updateUser
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
method: 'DELETE',
|
||
|
|
route: '/:id',
|
||
|
|
handlers: [
|
||
|
|
validator.ensureTargetUserOrAdmin,
|
||
|
|
controller.getUser,
|
||
|
|
controller.deleteUser
|
||
|
|
]
|
||
|
|
}
|
||
|
|
]
|