-
Notifications
You must be signed in to change notification settings - Fork 30
Swagger Docs
Once you have installed appy-backend and seeded the database you are ready to start exploring your endpoints via the swagger docs. Using the default configuration, you can start up your server with $ npm start
and point a browser to http://localhost:8080/ to view the swagger docs.
To login, expand the POST /login
endpoint, click on the Try it out
button to the right, and use values test@superadmin.com
for the email and root
for the password. Now click the Execute
button under the body. This should give you a response similar to the following:
{
"user": {
"_id": "5ade57db285efc67273773d6",
"firstName": "Ora",
"lastName": "Rutherford",
"email": "test@superadmin.com",
"title": "Legacy Security Director",
"profileImageUrl": "https://s3.amazonaws.com/uifaces/faces/twitter/rpeezy/128.jpg",
"password": "",
"pin": "",
"role": "5ade57d9285efc67273773b6",
"isActive": true,
"roleName": "Super Admin",
"roleRank": 0,
"createdAt": "2018-04-23T22:02:03.085Z",
"isEnabled": true,
"passwordUpdateRequired": false,
"pinUpdateRequired": false,
"isDeleted": false,
"__v": 0
},
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZXNzaW9uSWQiOiI1ZTkzODNhODQ5YTZlZTYyZDhjOWRiMzMiLCJzZXNzaW9uS2V5IjoiY2Q2YTNjNzktM2YyNy00YmExLWFiMWUtNjcxMzM3ZDhiNmM1IiwicGFzc3dvcmRIYXNoIjoiJDJhJDEwJFZ1L095bXJmSVZCWXVWS1A1U3NUS3VyUmkuWUkyTndUTHhPOXlKQ3VvLlYzc2ViQlVTelgyIiwic2NvcGUiOlsiU3VwZXIgQWRtaW4iLCJyb290IiwidXNlci01YWRlNTdkYjI4NWVmYzY3MjczNzczZDYiXSwiaWF0IjoxNTg2NzI1ODAwLCJleHAiOjE1ODkzNTM4MDB9.2Ppt0qyls5TNjEzca2Kao2mDFRT2_3VAvfL3EizxQDc",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImZpcnN0TmFtZSI6Ik9yYSIsImxhc3ROYW1lIjoiUnV0aGVyZm9yZCIsImVtYWlsIjoidGVzdEBzdXBlcmFkbWluLmNvbSIsInJvbGUiOiI1YWRlNTdkOTI4NWVmYzY3MjczNzczYjYiLCJyb2xlTmFtZSI6IlN1cGVyIEFkbWluIiwicm9sZVJhbmsiOjAsImNyZWF0ZWRBdCI6IjIwMTgtMDQtMjNUMjI6MDI6MDMuMDg1WiIsIl9pZCI6IjVhZGU1N2RiMjg1ZWZjNjcyNzM3NzNkNiJ9LCJzY29wZSI6WyJTdXBlciBBZG1pbiIsInJvb3QiLCJ1c2VyLTVhZGU1N2RiMjg1ZWZjNjcyNzM3NzNkNiJdLCJpYXQiOjE1ODY3MjU4MDAsImV4cCI6MTU4NjcyNjQwMH0.Yf1OFedgBWYOzMXNk4XHW4SRlMwpiV95AM0EF9O2234",
"scope": [
"Super Admin",
"root",
"user-5ade57db285efc67273773d6"
]
}
You can now copy the token values for either refreshToken
or accessToken
to access any endpoints requiring authentication (for more details on authentication check out the authentication page). To test this out, try pasting the token into the value for authorization
on the GET /user
endpoint, scroll down past the query parameters, and again click the Try it out
and Execute
buttons. This should respond with a list of the seed users.
View this gif to see this in action.
Congrats! You can now use your token values (as long as they are valid) to explore the remaining endpoints and play with different query parameters.