You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/0/en/part0b.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Open the [example application](https://studies.cs.helsinki.fi/exampleapp) in you
17
17
18
18
The course material is done with the Chrome browser.
19
19
20
-
**The 1st rule of web development**: Always keep the Developer Console open on your web browser. On macOS, open the console by pressing _F12_ or _option-cmd-i_ simultaneously. On Windows or Linux, open the console by pressing _F12_ or _ctrl-shift-i_ simultaneously. The console can also be opened via the [context menu](https://en.wikipedia.org/wiki/Menu_key).
20
+
**The 1st rule of web development**: Always keep the Developer Console open on your web browser. On macOS, open the console by pressing _fn_-_F12_ or _option-cmd-i_ simultaneously. On Windows or Linux, open the console by pressing _Fn_-_F12_ or _ctrl-shift-i_ simultaneously. The console can also be opened via the [context menu](https://en.wikipedia.org/wiki/Menu_key).
21
21
22
22
Remember to <i>always</i> keep the Developer Console open when developing web applications.
23
23
@@ -33,7 +33,7 @@ Make sure that the <i>Network</i> tab is open, and check the <i>Disable cache</i
33
33
34
34
The server and the web browser communicate with each other using the [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) protocol. The <i>Network</i> tab shows how the browser and the server communicate.
35
35
36
-
When you reload the page (press the F5 key or the ↻ symbol on your browser), the console will show that two events have happened:
36
+
When you reload the page (To refresh a webpage, on windows, press the _Fn_-_F5_ keys. On macOS, press _command_-_R_. Or press the ↻ symbol on your browser), the console will show that two events have happened:
37
37
38
38
- The browser has fetched the contents of the page <i>studies.cs.helsinki.fi/exampleapp</i> from the server
39
39
- And has downloaded the image <i>kuva.png</i>
@@ -112,7 +112,7 @@ app.get('/', (req, res) => {
112
112
113
113
You don't have to understand the code just yet.
114
114
115
-
The content of the HTML page has been saved as a template string or a string that allows for evaluating, for example, variables in the midst of it. The dynamically changing part of the homepage, the number of saved notes (in the code <em>noteCount</em>), is replaced by the current number of notes (in the code <em>notes.length</em>) in the template string.
115
+
The content of the HTML page has been saved as a template string or a string that allows for evaluating, for example, variables, like <em>noteCount</em>, in the midst of it. The dynamically changing part of the homepage, the number of saved notes (in the code <em>noteCount</em>), is replaced by the current number of notes (in the code <em>notes.length</em>) in the template string.
116
116
117
117
Writing HTML amid the code is of course not smart, but for old-school PHP programmers, it was a normal practice.
118
118
@@ -164,7 +164,7 @@ xhttp.send()
164
164
165
165
The details of the code are not important right now, but some code has been included to spice up the images and the text. We will properly start coding in [part 1](/en/part1). The sample code in this part is actually not relevant at all to the coding techniques of this course.
166
166
167
-
> Some might wonder why xhttp-object is used instead of the modern fetch. This is due to not wanting to go into promises at all yet, and the code having a secondary role in this part. We will return to modern ways to make requests to the server in part 2.
167
+
> Some might wonder why xhttp-object is used instead of the modern fetch. This is due to not wanting to go into promises at all yet, and the code having a secondary role in this part. We will return to modern ways to make requests to the server in [part 2](/en/part2).
168
168
169
169
Immediately after fetching the <i>script</i> tag, the browser begins to execute the code.
170
170
@@ -381,7 +381,7 @@ The file defines two [class selectors](https://developer.mozilla.org/en-US/docs/
381
381
382
382
A class selector definition always starts with a period and contains the name of the class.
383
383
384
-
The classes are [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class), which can be added to HTML elements.
384
+
Classes are [attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class), which can be added to HTML elements.
385
385
386
386
CSS attributes can be examined on the <i>elements</i> tab of the console:
387
387
@@ -391,7 +391,7 @@ The outermost <i>div</i> element has the class <i>container</i>. The <i>ul</i> e
391
391
392
392
The CSS rule defines that elements with the <i>container</i> class will be outlined with a one-pixel wide [border](https://developer.mozilla.org/en-US/docs/Web/CSS/border). It also sets 10-pixel [padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) on the element. This adds some empty space between the element's content and the border.
393
393
394
-
The second CSS rule sets the text color of the notes as blue.
394
+
The second CSS rule sets the text color of the <i>notes</i> class as blue.
395
395
396
396
HTML elements can also have other attributes apart from classes. The <i>div</i> element containing the notes has an [id](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) attribute. JavaScript code uses the id to find the element.
397
397
@@ -409,7 +409,7 @@ Let's review what happens when the page <https://studies.cs.helsinki.fi/examplea
409
409
410
410
- The browser fetches the HTML code defining the content and the structure of the page from the server using an HTTP GET request.
411
411
- Links in the HTML code cause the browser to also fetch the CSS style sheet <i>main.css</i>...
412
-
- ...and a JavaScript code file <i>main.js</i>
412
+
- ...and the JavaScript code file <i>main.js</i>
413
413
- The browser executes the JavaScript code. The code makes an HTTP GET request to the address <https://studies.cs.helsinki.fi/exampleapp/data.json>, which
414
414
returns the notes as JSON data.
415
415
- When the data has been fetched, the browser executes an <i>event handler</i>, which renders the notes to the page using the DOM-API.
@@ -471,7 +471,7 @@ notes.push({
471
471
})
472
472
```
473
473
474
-
The Note objects have two fields: <i>content</i> containing the actual content of the note, and <i>date</i> containing the date and time the note was created.
474
+
Each note object has two fields: <i>content</i> containing the actual content of the note, and <i>date</i> containing the date and time the note was created.
475
475
476
476
The server does not save new notes to a database, so new notes disappear when the server is restarted.
477
477
@@ -486,7 +486,7 @@ All of the data shown on the page was fetched with the HTML code generated by th
486
486
487
487
The Notes page uses AJAX to fetch the notes data. Submitting the form still uses the traditional mechanism of submitting web forms.
488
488
489
-
The application URLs reflect the old, carefree times. JSON data is fetched from the URL <https://studies.cs.helsinki.fi/exampleapp/data.json> and new notes are sent to the URL <https://studies.cs.helsinki.fi/exampleapp/new_note>.
489
+
The application URLs reflect the old, carefree times. JSON data is fetched from the URL <https://studies.cs.helsinki.fi/exampleapp/data.json> and new notes are sent to the URL <https://studies.cs.helsinki.fi/exampleapp/new_note>.
490
490
Nowadays URLs like these would not be considered acceptable, as they don't follow the generally acknowledged conventions of [RESTful](https://en.wikipedia.org/wiki/Representational_state_transfer#Applied_to_web_services) APIs, which we'll look into more in [part 3](/en/part3).
491
491
492
492
The thing termed AJAX is now so commonplace that it's taken for granted. The term has faded into oblivion, and the new generation has not even heard of it.
@@ -593,7 +593,7 @@ The status of React seems strong, but the world of JavaScript is ever-changing.
593
593
594
594
What does the name of the course, <i>Full stack web development</i>, mean? Full stack is a buzzword that everyone talks about, but no one knows what it means. Or at least, there is no agreed-upon definition for the term.
595
595
596
-
Practically all web applications have (at least) two "layers": the browser, being closer to the end-user, is the top layer, and the server the bottom one. There is often also a database layer below the server. We can therefore think of the <i>architecture</i> of a web application as a kind of <i>stack</i> of layers.
596
+
Practically all web applications have (at least) two "layers": the browser, being closer to the end-user, is the top layer, and the server the bottom one. There is often also a database layer below the server. We can therefore think of the <i>architecture</i> of a web application as a <i>stack</i> of layers.
597
597
598
598
Often, we also talk about the [frontend and the backend](https://en.wikipedia.org/wiki/Front_and_back_ends). The browser is the frontend, and JavaScript that runs on the browser is frontend code. The server on the other hand is the backend.
599
599
@@ -666,24 +666,24 @@ The diagram was made as a GitHub Markdown-file using the [Mermaid](https://docs.
0 commit comments