This document describes the sequence of events when using the Notes application hosted on studies.cs.helsinki.fi. The application allows users to view, add, and save notes, either in a traditional server-rendered manner or as a Single Page Application (SPA).
📌 This README is prepared for Part 0 of the Full Stack Open course.
-
🟢 User opens the page:
- The browser requests the main HTML document from the server.
- The server responds with the requested HTML document.
-
🎨 Loading Styles and Scripts:
- The browser fetches
main.cssandmain.jsfrom the server.
- The browser fetches
-
📥 Fetching Existing Notes:
- The browser makes a request to
data.jsonto retrieve existing notes. - The server responds with a JSON array containing previously saved notes.
- The browser then renders these notes on the page.
- The browser makes a request to
-
✍️ User Adds a Note:
- The user writes a note in the input field and submits it.
- The browser sends a
POSTrequest to save the new note. - The server responds with an HTTP 302 redirect to
/notes, prompting the browser to reload the updated notes. - The browser fetches the latest data and renders the new note.
-
🌍 User Navigates to SPA:
- The browser requests the SPA-specific HTML document from the server.
- The server responds with the HTML page.
-
🎨 Loading Styles and Scripts:
- The browser loads
main.cssandspa.js.
- The browser loads
-
📥 Fetching Notes in SPA Mode:
- JavaScript fetches
data.jsonand updates the page dynamically without a full reload.
- JavaScript fetches
-
📝 User Adds a Note in SPA Mode:
- The user writes a note and clicks the "Save" button.
- A
POSTrequest is sent tonew_note_spa. - The server responds with HTTP 201 Created.
- JavaScript updates the page dynamically without reloading.
Bu doküman, studies.cs.helsinki.fi üzerinde barındırılan Notlar uygulamasının işleyişini açıklar. Uygulama, kullanıcıların notları görüntülemesine, eklemesine ve kaydetmesine olanak tanır. Hem geleneksel sunucu taraflı işleyiş hem de Tek Sayfa Uygulaması (SPA) olarak kullanılabilir.
📌 Bu README, Full Stack Open kursunun Part 0 bölümü için hazırlanmıştır.
-
🟢 Kullanıcı sayfayı açar:
- Tarayıcı, ana HTML belgesini sunucudan talep eder.
- Sunucu, HTML belgesini döner.
-
🎨 CSS ve JavaScript dosyalarının yüklenmesi:
- Tarayıcı,
main.cssvemain.jsdosyalarını sunucudan alır.
- Tarayıcı,
-
📥 Mevcut Notların Getirilmesi:
- Tarayıcı,
data.jsondosyasını talep eder. - Sunucu, daha önce kaydedilmiş notların bulunduğu JSON dizisini döner.
- Tarayıcı, notları ekrana çizer.
- Tarayıcı,
-
✍️ Kullanıcı Not Ekler:
- Kullanıcı bir not yazar ve gönderir.
- Tarayıcı, yeni notu kaydetmek için
POSTisteği gönderir. - Sunucu, HTTP 302 yönlendirmesi ile yanıt verir ve tarayıcı sayfayı yeniden yükleyerek güncellenmiş notları gösterir.
-
🌍 Kullanıcı SPA'ya Gider:
- Tarayıcı, SPA için özel olarak tasarlanmış HTML belgesini sunucudan talep eder.
- Sunucu, HTML sayfasını döner.
-
🎨 CSS ve JavaScript Dosyalarının Yüklenmesi:
- Tarayıcı,
main.cssvespa.jsdosyalarını yükler.
- Tarayıcı,
-
📥 SPA Modunda Notların Getirilmesi:
- JavaScript,
data.jsondosyasını talep eder ve sayfayı dinamik olarak günceller.
- JavaScript,
-
📝 SPA Modunda Not Eklenmesi:
- Kullanıcı bir not yazar ve "Kaydet" butonuna basar.
new_note_spaadresinePOSTisteği gönderilir.- Sunucu, HTTP 201 Created ile yanıt verir.
- JavaScript, sayfayı yeniden yüklemeden günceller.
Bu doküman, uygulamanın işleyişini ve HTTP isteklerinin akışını açıklamaktadır. 🎯