app.get ("/", function (request, response) {
// Submit HTML
});
To let the page be sent aside and to understand how Express is used, each
Express application has four functions that are
used to receive and route
requests: get, post, put, and del. These functions correspond to common
HTTP verbs. But what are HTTP verbs?
How does HTTP work?
Each time you visit a web page, your browser
sends a request to the GET
for the content in the link you typed to the server hosting the site. This
HTTP request is similar to the following example (intentionally simplified):
GET www.myblog.com/hello-world HTTP / 1.1
Accept: text / html
Accept-Language: ar-sy, ar;
User-Agent: Mozilla / 5.0 (X11; Linux x86_64; rv: 34.0) Gecko /
20100101 Firefox / 34.0
The Accept and Accept-Language ... fields are called Request Headings,
and each header has a meaning for the server that receives the request. For
example, the browser in the User-Agent field identifies itself, which allows
the server to send a customized answer to each browser (for example, if
desired).
In the Accept-Language field, the browser sends the languages
that the user wants to see the answer in. The server sends the page in Arabic
(Syria) ar-sy
in our case if it is available, or in Arabic as a second option ...
and so on. The server responds to the request with an HTTP Response
similar to our example:
HTTP / 1.1 200 OK
Content-Type: text / xml; charset = utf-8
Content-Length: 3918