# Server - HTTP request & response

Server回http response時粗略來分有兩種:

1. Routing/Resource type (html, css, images),&#x20;
2. Restful/API type, e.g.`{name:"apple"}`.

**Routing:**

```
最簡單的web server: 
  收到 grimmer.io 這個http request, 回傳根目錄下的 /index.html 
  收到 grimmer.io/about.html, 回傳 /about.html
變化的:  
  收到 grimmer.io/about.html, 回傳 /assets/about.html (實際上的檔案位置)
```

Restful endpoint:

```
收到 grimmer.io/doc/doc1, 回傳doc1的內容，可以為XML, JSON等。 
通常是JSON, e.g. {author:"mike", content:"blahblah"}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lifeoverflow.gitbook.io/learning-javascript/shi-ji-ying-yong/server-http-request-and-response.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
