/
user.route.js
79 lines (74 loc) · 1.71 KB
/
user.route.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const express = require('express');
const checkJWT = require('../middlewares/checkJWT');
const userCtrl = require('../controllers/user.controller');
const router = express.Router();
/**
* @swagger
* /api/user/:
* get:
* tags:
* - Users
* name: Get users
* responses:
* 200:
* description: Without message
* schema:
* type: array
* items:
* type: object
* properties:
* name:
* type: string
* email:
* type: string
* 500:
* schema:
* type: object
* properties:
* error:
* type: string
* post:
* tags:
* - Users
* name: Create user
* consumes:
* - application/json
* parameters:
* - name: body
* in: body
* schema:
* type: object
* properties:
* email:
* type: string
* password:
* type: string
* format: password
* required:
* - email
* - password
* responses:
* 201:
* description: Without message
* schema:
* type: object
* properties:
* name:
* type: string
* email:
* type: string
* 403:
* description: Password field must not be blank
* 409:
* description: This email already exists
* 500:
* schema:
* type: object
* properties:
* error:
* type: string
*/
router.route('/')
.get(checkJWT(), userCtrl.list) // protected
.post(userCtrl.create); // unprotected
module.exports = router;