/backend-learning

Learning Next.js with psql

Primary LanguageJavaScript

As of today 2024-02-18

image image

As of today 2024-20-17

image image image

backend-learning

2024-FEB-08

Routing:

I've learned how to handle different HTTP methods (like GET and POST) in my server-side code. Additionally, I've grasped the concept of using the fetch API on the client side to send requests to these routes.

Posting Data:

I've learned the process of sending data from the client to the server using the fetch API. Specifically, I've learned how to collect form data using the FormData API, convert it to a JSON object, and send it as JSON in the body of a POST request. On the server side, I now know how to access this data from the req.body property.

Getting Data:

My understanding now includes querying data from a PostgreSQL database using the pg library. I've mastered the use of the pool.query method to send SQL queries to the database and retrieve the results.

Making Database Connections:

I've gained the ability to connect to a PostgreSQL database using the pg library. Furthermore, I've learned the importance of closing the database connection when it's no longer needed.

Working with JSON:

I've acquired the skill of converting JavaScript objects to JSON strings using JSON.stringify, and vice versa, parsing JSON strings back into JavaScript objects using JSON.parse.

Error Handling:

I've become proficient in handling errors in asynchronous code using try/catch blocks. Additionally, I've learned how to send appropriate HTTP status codes based on the outcome of the operation.