Todo List Tutorial
Primary version
Primary version
  • Welcome to the ngGirls tutorial!
  • Workshop: Todo List
    • πŸ‘€About
    • #0: πŸ’ƒ Introduction
    • #1: βŒ› Installations
      • a. StackBlitz instructions
    • #2: πŸ…° Angular kicks in
    • #3: πŸ“ Component
    • #4: ✏ A new component
      • a. StackBlitz instructions
    • #5: πŸ’Ό Class
    • #6: πŸ“₯ Property binding
    • #7: πŸ“€Event binding
    • #8: πŸ“Ž Element ref - #
      • a. About
      • b. Explore
      • c. Resources
    • #9: πŸ“‹ The To Do list
    • #10: βž• New component: todo-item
    • #11: β›“ Interface
      • a. StackBlitz instructions
    • #12: πŸ“ŒAdd items
    • #13: 🚧 Refactor App Component
    • #14: πŸ’… Adding Style
    • #15: πŸ”‹ Creating a Service
    • #16: 🎁 Add Items Using the Service
    • #17: πŸ’ΎLocal storage
    • #18: πŸ—‘ Remove item
    • #19: πŸ”˜ Adding a checkbox
    • #21: πŸ’ͺ Enrich the todo-item component
    • Appendix 1: Git and GitHub
    • Appendix 2: πŸ›° Deploying your app
      • Deploy to Azure Static Web Apps
      • Deploy to GitHub Pages
        • a. StackBlitz instructions
    • Appendix 3: Tutorial Extensions
    • Appendix 4: Generating a new project
    • Troubleshooting
      • Installation
  • More Workshops
    • Second workshops - CRUD and HTTP
      • #1 MongoDB
      • #2 Local server
      • #3 http in diagrams
      • #4 POST
      • #5 GET
      • #6 DELETE and PUT
    • Gallery with Rx.js
      • #0: Init photo gallery
      • #1: Observable
      • #2: More interaction! Upload photos
      • #3: Merging Observables
      • #4: Filtering by category
      • #5: Adding photos to category
    • Forms
      • #1: Template-driven forms
      • #2: Reactive forms
      • #3: Form builder
    • NgRx
      • #1: Actions and reducers
      • #2: Store Devtools
      • #3: Implementing actions in app
      • #4: Selectors
    • RxJS
      • Operators
      • Play time!
    • Blog Editor
      • #1 βš™οΈConfiguring firebase
      • #2 πŸ’…Add Angular Material
      • #3 πŸ’…Add Bootstrap
      • #4 🧭Add Navigation
      • #5 ✏️Add Editor
      • #6 βš™οΈConnect Database
      • #6 πŸ’…Add Feed
      • #7 ✏️Edit Post
      • #9 πŸš€Deploy
      • #10 ✏ ️Next Steps
Powered by GitBook
On this page
  • Working with data
  • Data flow across the internet
  • HTTP Requests
  • HTTP Response
  • Connecting to a server for data
  1. More Workshops

Second workshops - CRUD and HTTP

PreviousInstallationNext#1 MongoDB

Last updated 5 years ago

In the Todo List Tutorial you learned about adding, editing, and removing todo items. Let's expand on this by retrieving todo items from a server. By using a server to hold your todo list items, you power up your application to get data no matter where you are, and are no longer dependent on the local storage of your browser.

First, we'll cover a little vocabulary and background of the main components of how a web application connects to a server.

Working with data

All data operations use the same - we Create, Read, Update, and Delete (CRUD) data. We used CRUD operations in the Todo List Tutorial using local storage when we added and deleted todo list items, but we'll replace local storage with a database.

Data flow across the internet

HyperText Transfer Protocol (HTTP) is a standard communication pattern in computer networking. is the foundation of how data flows across the internet and we use HTTP every time we use the web. We already used HTTP under the covers in the Todo List application, but now we'll use HTTP communication to connect to a server. We'll summarize the main parts of HTTP that we'll use in this section of the tutorial.

All HTTP interactions have a request and a response.

HTTP Requests

Requests are made up of

  • headers

  • body (optional)

  • path

  • method

Methods define the way the request interacts with the server. The most common methods are:

  • GET

  • PUT

  • POST

  • DELETE

  • OPTIONS

HTTP Response

Responses are made up of

  • headers

  • body

  • status

Connecting to a server for data

Let's consider an example of how REST and HTTP relate to each other. Imagine HTTP is an oven used for baking cakes - in other words it's a foundation for baking yummy treats. πŸ˜‹ And let's imagine a cake represents data. 🍰 REST is like a baking pan used to hold the cake in a shape - if a baker doesn't use a cake pan, the cake won't have shape. Imagine REST is a round cake pan, a shape everyone is familiar with and bakers know how to decorate. REST is a common "language" that round cakes have so that all bakers have standard tools to work with them and have experience working with.

REST itself uses CRUD concepts. For example:

  • Create - POST

  • Read - GET

  • Update - PUT

  • Delete - DELETE

Web applications usually connect to a service that acts as a middle-woman to the database, also referred to as the server. This service assists with the database interactions by being a go-between for the two different programs, your To Do List app and the database. Each part of the system has to speak the same language so that they can interact with each other, and a commonly used interaction pattern is REpresentational State Transfer (REST). is a communication layer on top of HTTP for your app to interact with the server.

In the next steps we'll create a database and add basic CRUD functionality into your code. To assist in this process, we prepared some resources, such as a server, for you to use. You are welcome to at your convenience.

basic functions
HTTP
REST
review the source code of the server