File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export default [
1212 } ,
1313 {
1414 method : 'GET' ,
15- route : 'login' ,
15+ route : '/ login' ,
1616 handlers : [
1717 home . getLogin
1818 ]
Original file line number Diff line number Diff line change 4343 "parameters" : [
4444 {
4545 "in" : " body" ,
46- "name" : null ,
46+ "name" : " user " ,
4747 "description" : " User's crecredentials" ,
4848 "required" : true ,
4949 "schema" : {
9595 }
9696 }
9797 }
98+ },
99+ "/users" : {
100+ "post" : {
101+ "tags" : [
102+ " Users"
103+ ],
104+ "summary" : " Create user" ,
105+ "description" : " Create user API" ,
106+ "operationId" : " createUser" ,
107+ "produces" : [
108+ " application/json"
109+ ],
110+ "parameters" : [
111+ {
112+ "name" : " Body" ,
113+ "in" : " body" ,
114+ "required" : true ,
115+ "description" : " User details" ,
116+ "schema" : {
117+ "type" : " object" ,
118+ "properties" : {
119+ "user" : {
120+ "type" : " object" ,
121+ "properties" : {
122+ "name" : {
123+ "descrpition" : " Name" ,
124+ "type" : " string"
125+ },
126+ "username" : {
127+ "description" : " Username" ,
128+ "type" : " string"
129+ },
130+ "password" : {
131+ "description" : " Password" ,
132+ "type" : " string"
133+ }
134+ },
135+ "required" : [
136+ " name" ,
137+ " username" ,
138+ " password"
139+ ]
140+ }
141+ },
142+ "required" : [
143+ " user"
144+ ]
145+ }
146+ }
147+ ],
148+ "responses" : {
149+ "200" : {
150+ "description" : " User created" ,
151+ "schema" : {
152+ "type" : " object" ,
153+ "properties" : {
154+ "user" : {
155+ "type" : " object" ,
156+ "properties" : {
157+ "username" : {
158+ "type" : " string"
159+ },
160+ "name" : {
161+ "type" : " string"
162+ },
163+ "_id" : {
164+ "type" : " string"
165+ }
166+ }
167+ }
168+ }
169+ }
170+ },
171+ "422" : {
172+ "description" : " Unprocessable Entity"
173+ }
174+ }
175+ },
176+ "get" : {
177+ "tags" : [
178+ " Users"
179+ ],
180+ "security" : [
181+ {
182+ "Bearer" : []
183+ }
184+ ],
185+ "summary" : " Get all users" ,
186+ "description" : " Get Users" ,
187+ "operationId" : " getUsers" ,
188+ "produces" : [
189+ " application/json"
190+ ],
191+ "responses" : {
192+ "200" : {
193+ "type" : " array" ,
194+ "items" : {
195+ "type" : " object" ,
196+ "properties" : {
197+ "_id" : {
198+ "type" : " string"
199+ },
200+ "name" : {
201+ "type" : " string"
202+ },
203+ "username" : {
204+ "type" : " string"
205+ }
206+ }
207+ }
208+ },
209+ "401" : {
210+ "description" : " Unauthorized"
211+ }
212+ }
213+ }
214+ },
215+ "/users/{id}" : {
216+ "get" : {
217+ "tags" : [
218+ " Users"
219+ ],
220+ "security" : [
221+ {
222+ "Bearer" : []
223+ }
224+ ],
225+ "summary" : " Get user" ,
226+ "description" : " Get User" ,
227+ "operationId" : " getUser" ,
228+ "produces" : [
229+ " application/json"
230+ ],
231+ "parameters" : [
232+ {
233+ "name" : " id" ,
234+ "in" : " path" ,
235+ "type" : " string" ,
236+ "required" : true ,
237+ "description" : " User id"
238+ }
239+ ],
240+ "responses" : {
241+ "200" : {
242+ "type" : " object" ,
243+ "properties" : {
244+ "_id" : {
245+ "type" : " string"
246+ },
247+ "name" : {
248+ "type" : " string"
249+ },
250+ "username" : {
251+ "type" : " string"
252+ }
253+ }
254+ },
255+ "401" : {
256+ "description" : " Unauthorized"
257+ }
258+ }
259+ }
98260 }
99261 }
100262}
Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ basePath: "/"
99schemes :
1010- https
1111tags :
12- - name : Auth
13- description : Authenticate user
14- - name : User
15- description : User related api
12+ - name : Auth
13+ description : Authenticate user
14+ - name : User
15+ description : User related api
1616securityDefinitions :
1717 Bearer :
1818 description : Example value:- Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjU5MmQwMGJhNTJjYjJjM
3131 - application/json
3232 parameters :
3333 - in : body
34- name :
34+ name : user
3535 description : User's crecredentials
3636 required : true
3737 schema :
@@ -64,3 +64,108 @@ paths:
6464 description : Unauthorized
6565 ' 500 ' :
6666 description : Internal Server Error
67+ " /users " :
68+ post :
69+ tags :
70+ - Users
71+ summary : Create user
72+ description : Create user API
73+ operationId : createUser
74+ produces :
75+ - application/json
76+ parameters :
77+ - name : Body
78+ in : body
79+ required : true
80+ description : ' User details'
81+ schema :
82+ type : object
83+ properties :
84+ user :
85+ type : object
86+ properties :
87+ name :
88+ descrpition : ' Name'
89+ type : string
90+ username :
91+ description : ' Username'
92+ type : string
93+ password :
94+ description : ' Password'
95+ type : string
96+ required :
97+ - name
98+ - username
99+ - password
100+ required :
101+ - user
102+ responses :
103+ ' 200 ' :
104+ description : User created
105+ schema :
106+ type : object
107+ properties :
108+ user :
109+ type : object
110+ properties :
111+ username :
112+ type : string
113+ name :
114+ type : string
115+ _id :
116+ type : string
117+ ' 422 ' :
118+ description : Unprocessable Entity
119+ get :
120+ tags :
121+ - Users
122+ security :
123+ - Bearer : []
124+ summary : Get all users
125+ description : Get Users
126+ operationId : getUsers
127+ produces :
128+ - application/json
129+ responses :
130+ ' 200 ' :
131+ type : array
132+ items :
133+ type : object
134+ properties :
135+ _id :
136+ type : string
137+ name :
138+ type : string
139+ username :
140+ type : string
141+ ' 401 ' :
142+ description : Unauthorized
143+ " /users/{id} " :
144+ get :
145+ tags :
146+ - Users
147+ security :
148+ - Bearer : []
149+ summary : Get user
150+ description : Get User
151+ operationId : getUser
152+ produces :
153+ - application/json
154+ parameters :
155+ - name : id
156+ in : path
157+ type : string
158+ required : true
159+ description : ' User id'
160+ responses :
161+ ' 200 ' :
162+ type : object
163+ properties :
164+ _id :
165+ type : string
166+ name :
167+ type : string
168+ username :
169+ type : string
170+ ' 401 ' :
171+ description : Unauthorized
You can’t perform that action at this time.
0 commit comments