Somewhere you have a conceptual disconnect. I donβt know exactly where I am going to try to highlight some of the basics in the hope that I can fill in the corresponding gap somewhere along the way.
, - localhost:3000
. , localhost
, , . , , HTML, CSS, JavaScript .., .
URL- http://localhost:3000/
HTTP GET
/
localhost:3000
. - , " " ( "", , , ). , "" . .
, . , " ", .
, , , app.get('/', ...
. res.render
Handlebars HTML. , . , , , .
- , . , . , . . HTML (.. ) DOM. , , ( ) . , tag
, element
node DOM. DOM , .
" "? ? , . , , " ". , HTTP-/, , . . HTML HTML DOM, JSON JavaScript, .
, /
, "" , . , . , , HTTP-, , Handlebars HTML.
, URL- , , CSS, JavaScript .. DOM, URL- HTTP- , . , /
, , : .
, .
, - , .. , <a href="/other-url">click</a>
. URL- .
HTML , , POST
. <form>
(, form
<
>
, , <form>
, DOM). . URL- , . ( , , ).
. -. AJAX.
AJAX, HTTP- JavaScript . , AJAX, , , .
. AJAX, JSON. jQuery JSON DOM . , .
, , , , . ββ DOM, jQuery, , Handlebars. DRY, , .
- AJAX . Handlebars ( ) , JavaScript AJAX . , SEO, SPA , , .
. , AJAX, (, window.location.reload()
). AJAX. URL- . , , , res.render
, /
.
, - .
AJAX , JSON HTML- . Handlebars , , HTML, , HTML .
. JSON, Handlebars . , JS Handlebars . , AJAX , , .
, , . , , , , , . , - , HTTP-.