Update the previous mock server with the following:
api/login
api/logout
loggedIn
and set true/false value based on the above APIs.Update the get/message
default handler to return the message Hello: fname lname
if user is logged in by reading from the query parameters otherwise Hello: Guest
is the customer Id is less than equal to 5 characters.
Update the get/message
Hello Universe
variant to modify the file to following using transpose data based on if user is logged in or logged out
- User Logged In
{
message: fname lname
}
- User Logged Out
{
message: Guest
}
Start mock server
Hit get/message
with customer id length <=5 and see you should get Hello: Guest
Set the variant to Hello Universe
Hit get/message
with customer id length <=5 and see you should get message: Guest
Hit api/login
Set the variant to default
Hit http://localhost:8000/get/message/12345?fname=John&lname=Doe with customer id length <=5 and see you should get Hello: John Doe
.
Set the variant to Hello Universe
Hit http://localhost:8000/get/message/12345?fname=John&lname=Doe with customer id length <=5 and see you should get message:John Doe
Hit api/logout
and repeat 5 to 7.
Create and install certificates to enable HTTPS in Midway.
Update run-mock-server-console.js to enable https in mock server.
Start mock server and navigate to https://localhost:4444/_admin and repeat 5 to 12 steps.