# 20210129(금)

## 2021-01-29

### 1. 학습 날짜

* 2020-01-29

### 2. 학습 시간

* 11:00 \~ 26:00

### 3. 학습 범위 및 주제

* 웹서버 평가
* 여러가지 문제 해결

### 4. 학습 목표

* 웹서버 평가를 마친다.
* 백본을 이용해서 페이지를 띄어본다.

### 5. 학습 정리

* x

### 6. 상세 학습 내용

* 지금 사용하고 있는 `index.html.erb` 를 보면 온통 `render partial` 로 도배 되어있는걸 확인할 수 있다.
* 이 `render partial` 은 파일의 단위를 모듈별로 나눌수 있게 해준다. 그리고 각 파셜로 `render` 되는 파일들을 살펴보면 대부분이 `script` 태그로 감싸져있는 `underscore template` 파일임을 확인할 수 있다.
* 이 `underscore template` 들은 `backboneJS` 의 `view` 에서 사용할 정보들이다.
* 따라서 서버가 실행되고 클라이언트가 `SPA` 앱에 접속한다면 우리의 서버는 가장 먼저 `index.html.erb` 파일을 클라이언트에게 보내려고 한다. 근데 보내는 `html` 파일(모든 돔 요소가 생성되기전에)을 `partial` 부분까지해서 다 보내기 전에 `javascript` 가 개입을 해서 먼저 `script` 파일을 찾으면 어떻게 될까?
  * 당연히 문제가 생긴다.
* 그렇다면 모든 `HTML DOM` 요소가 세팅되기 전에 `BackboneJS` 가 개입하지 않게 하려면 어떻게해야하는가?
* 방법은 간단하다. `jQuery`의 방법을 사용하는것!
* ```javascript
  $(document).ready(function () {
    let MainView = Backbone.View.extend({
      el: "#temp-view",

      initialize: function () {
        console.log("MainView");
        this.current_view = null;
      },
  ...
  ```
* 위 처럼 사용할 `JS`를 **모든 DOM 요소가 준비가 되면 생성하라** 하는 명령을 해주면 된다.

### 7. 오늘 학습 내용에 대한 개인적인 총평

* 웹서버 평가가 끝났다. 그리고 이후에는 진짜 트랜센던스 기초 작업을 했다. 흠... 너무 늦었다 머리가 아프다 그래도 재밌으니깐 봐준다.

### 8. 다음 학습 계획

* 백본과 친해지기


---

# 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://simian114.gitbook.io/blog/undefined-1/diary/2021/january/20210129.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.
