2017-10-18

3323 단어
렌더링은 템플릿에 데이터를 대입하는 과정입니다.


    
        
        
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            .content{
                margin: 0 auto;
                margin-top: 100px;
                width: 500px;
                height: 500px;
                overflow: auto;
                border: 1px solid;
            }
            .cont{
                height: 1500px;
            }
            .con{
                height: 50px;
                margin-top: 50px;
                margin-bottom: 150px;
                background: yellowgreen;
                position: -webkit-sticky;
                position: sticky;
                top: 0;
            }
        </style>
    
    
        <div class="content">
            <div class="cont">
                <div class="con con-one">content-one</div>
                <div class="con con-two">content-two</div>
                <div class="con con-thr">content-three</div>
                <div class="con con-fou">content-four</div>
            </div>
        </div>
    

</code></pre> 
 <p>position: sticky     ,      </p> 
 <p>   (middleware)    HTTP     ,          ,       </p> 
 <p>use express        ,       </p> 
 <p>all    ,             ,    “*”         </p> 
 <p>  get    ,Express   post、put、delete  , HTTP    Express   <br/>           ,       。        ,Express      。</p> 
 <pre><code>app.get("/hello/:who", function(req, res) {
  res.end("Hello, " + req.params.who + ".");
});
</code></pre> 
 <p>      HTTP   ,            ,   setHeader   end  。</p> 
 <pre><code>app.get('/', function(req, res){
  var body = 'Hello World';
  res.setHeader('Content-Type', 'text/plain');
  res.setHeader('Content-Length', body.length);
  res.end(body);
});
</code></pre> 
 <p>       ,res.send           <br/> res.sendfile      </p> 
 <p>req.params.xxxxx  path    <br/> req.query.xxxxx  get  ?xxxx= <br/> req.body.xxxxx  post    </p> 
 <p>cors        </p> 
 <p>      ,       CORS  。    ,        ,    Origin  。<br/>   Origin           ,        ,          </p> 
 <pre><code>Access-Control-Allow-Origin: http://api.bob.com
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: FooBar
Content-Type: text/html; charset=utf-8
</code></pre> 
 <p>                    ,       PUT DELETE,  Content-Type      application/json。</p> 
 <p>      CORS  ,        ,    HTTP    ,  “  ”  (preflight)。</p> 
 <p>  Origin  ,“  ”              。</p> 
 <p>(1)Access-Control-Request-Method</p> 
 <p>       ,        CORS       HTTP  ,   PUT。</p> 
 <p>(2)Access-Control-Request-Headers</p> 
 <p>              ,     CORS             ,   X-Custom-Header。</p> 
</article>
                            </div>
                        </div>

좋은 웹페이지 즐겨찾기