beatrixcendana / Intro-to-Serverless-Project

This is my first Intro to Serverless Project for the summer camp 2021. I mostly work with API, Azure function, Postman, Twilio, and front-end stuff.
GNU General Public License v3.0
1 stars 1 forks source link

Deepsecrets #17

Closed beatrixcendana closed 3 years ago

ghost commented 3 years ago

Week 3 Step 8 ⬤⬤⬤⬤⬤⬤⬤⬤◯ | 🕐 Estimated completion: 10-20 minutes

Exposed!!

✅ Task:

Modify the deepsecrets Azure Function to

❗ Make sure to return your message in this format:

Thanks 😊! Stored your secret "insert_user's_message". 😯 Someone confessed that: "a_random_secret"

🚧 Test Your Work

To test your work, send your Twilio number a text message. You should still receive a text back that contains a message similar to the one below, but now the second secret returned will be random, and no longer the most recent secret stored!

Thanks 😊! Stored your secret "insert_user's_message". 😯 Someone confessed that: "a_random_secret"

💡 Yay! This means you've successfully queried for and returned a random secret.


1. Modifying the SQL Query

In your createDocument function, you'll first want to modify the original SQL query to now query for all secrets inside your container.

:question: How do I select all secrets? ```js const querySpec = { query: "SELECT * from c" }; ```

2. Selecting a Random Item

Next, you'll want to select a random secret by:

  1. Generating a random integer that is strictly less than the length of the array of secrets. (Hint: use Math.floor() and Math.random())
  2. Returning the secret at an index of this random number.
:question: How do I generate a random number for the index? The `Math.floor()` function returns the [floor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor) of the given number - ie. the largest integer less than or equal to a given number. In the example below, the generated random number will never be greater than `items.length`. ```js var random_value = Math.floor(items.length * Math.random()); ```

:bulb: Make sure to change your responseMessage to return the correct index of items.

ghost commented 3 years ago

📝 Week 3 Livestream Feedback

Please complete after you've viewed the Week 3 livestream! If you haven't yet watched it but want to move on, just close this issue and come back to it later.

Comment your feedback:

Help us improve BitCamp Serverless - thank you for your feedback! Here are some questions you may want to answer:

:camping: To move on, comment your feedback.

beatrixcendana commented 3 years ago

How was the content? Did it help you? Was it too challenging or too easy? Did it help you complete the week's homework?

Week 3 doesn't sound challenging as Week 2. I think Week 3 has a good amount of content. I don't feel too overwhelmed working on Week 3. The videos help me a lot to finish my homework.

How was the pace? Was it hard to follow along? Did we go too slow?

The pace is good. Only Step 7 was hard to follow along.

If you could add/improve something to/in the livestream, what would it be?

I think I had a problem understanding the instruction because I saw the instructions from the video and instructions from my repo were not the same.

ghost commented 3 years ago

Providing Feedback

What was confusing about this week? If you could change or add something to this week, what would you do? Your feedback is valued and appreciated!

beatrixcendana commented 3 years ago

What was confusing about this week? If you could change or add something to this week, what would you do? Your feedback is valued and appreciated!

I think I am confused with step 7 only. So far, week 3 has the best content and documentation.

ghost commented 3 years ago

⏰ Time to merge!

Go ahead and merge this branch to main to move on. Great work finishing this section!

merge

⚠️ If you receive a Conflicts error, simply press Resolve conflicts and you should be good to merge!