12 Dec 2022 to 18 Dec 2022
Weekly forecast
- Work on Resume and job hunting
I will fail often in order to succeed only once. —by OG Mandino
JobPin’s work has been deployed to production. what a good news. people can use our resume builder function on website now.
Go to the teams page, I can find my profile photo showed on the website!!!
weather APP
- use the google place autocomplete API component to get address
- after autocomplete API rerender the page, input box lose focus resolve by adding an autoFocus Attribute to the input node.
if need to get event and parameter at the same time, try the following method(Currying) 柯里化
1
2
3
const handleSearchButton = (param) => async (event) => {
return <div>something</div>;
};
- when try to refactor above code to a ‘normal arrow function’, chrome keeps refreshes, I am worried about the free API quota/credit, so I decided to use vs debug instead of console log to find what is happening here.
the above issue is solved, because there is a form onsubmit method, that bind to the function, change it to HOC.
- actually, that is not necessary. use this
1
2
3
4
5
const handleSearchButton = async (param) => {
return (event) => {
//do something with event
};
};
- so the event can be ‘caught’ by the returned arrow function inside the async function.
build a proxy server to store API key.
- to protect the API key, I will build a proxy server to forward the GET request with API key stored on proxy server.
- concept:
- build the server to handle request weather data and send it back to frontend.
- front end send request with city location & query param(air quality) to server for auto complete
- server return the address suggestions for processing
- by selecting the address, front end send the lon/lat data to backend
- backend use async request to get weather data and send to front end
- Steps
- write the very simple index.js for the node js server.
- send lat & lon to server and server console log / send it back to front(need routing, parsing)
AWS S3 delete issue
- only the creator can delete S3 bucket by default(root user cannot delete a bucket created by the other user)
Weekly summary
- API key can be stored as environment parameter on AWS as backend deployment(amplify can handle the environment variables).likn