Workshop 7 - Node, Express, and PostgreSQL

Dive into backend development by building a RESTful API with Node and Express, and learn to manage data with PostgreSQL.

Workshop Topics

  • Building a Node & Express Backend
    In this session, we’ll begin with a foundational look at backend development, specifically creating RESTful APIs with Node and Express. We'll cover:

    • A brief overview of REST principles and why APIs are crucial for connecting frontend applications to backend services.
    • Introduction to Express, a Node.js framework, that simplifies API development.
    • A hands-on demonstration of setting up a basic Express server and defining routes to handle incoming requests.
  • Working with Databases
    Next, we’ll dive into databases, focusing on the importance of managing data in backend applications.

    • We’ll discuss why databases are vital for storing and retrieving data, and explore different types such as SQL and NoSQL, with a focus on PostgreSQL.
    • SQL Basics: Learn the core concepts of SQL, and why relational databases are commonly used for data integrity.
    • FOLLOW-ALONG: Setting up a PostgreSQL database on Render.com and connecting to it locally, using VSCode and a PostgreSQL extension to manage and query data.
  • Understanding APIs
    We’ll explore the role of APIs in backend development, examining what they are, why they’re needed, and how they work.

    • We’ll discuss RESTful APIs in depth, highlighting concepts like statelessness and idempotency, and introduce HTTP methods (GET, POST, PUT, DELETE) to handle data interactions.
    • HTTP Requests and Responses: We'll break down the structure of HTTP requests, covering verbs, parameters, and body, and show how to process responses and handle errors effectively.
    • API Security: We’ll introduce environment variables using .env files for secure API keys and database connections.
  • Creating Your First API
    In this practical section, we’ll guide you through creating a simple API using Node and Express, setting up routes to interact with our PostgreSQL database.

    • FOLLOW-ALONG: Build and test a Node/Express API, using tools like CURL or Postman to make requests and check responses. We'll also go over connecting your backend to a frontend application on localhost.
    • Deployment: If time allows, we’ll deploy the API to Render, making it accessible from anywhere and practice making requests to this deployed backend.

Materials

Workshop recordingSlidesHomework
LinkLinkAssignment 7