Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 1x 1x 1x 1x 1x 1x 1x 178x 1x | import * as express from 'express';
import signUpController from '@app/routes/auth/signUp/sign-up-controller';
import {asyncWrapper} from '@util/async-wrapper';
import {
createValidationRouter,
} from '@app/validators';
import {body} from 'express-validator';
const router: express.Router = express.Router();
export const signUpValidator = [
body('username').exists().withMessage('username is missing').isUsername(),
body('email')
.exists().withMessage('email is missing')
.escape()
.trim()
.isEmail()
.withMessage('Email has to be a valid email address'),
body('password').exists().withMessage('password is missing').isPassword(),
];
/**
* Add the {@link signUpValidationHandler} to the router.
*/
router.post(
'/',
createValidationRouter(
'sign-up',
signUpValidator,
(req) => `Sign up as \"${req.body.username}\"`,
),
asyncWrapper(signUpController),
);
export default router;
|