javascript - getting backbone to serve static html files -


here directory structure on server

public/js/...

  /css/...   /img/...   /demo   /demo/button/index.html   /demo/slider/index.html   /demo/dialogbox/index.html 

in normal backbone route handler, need create view object in which, there model. model fetch data rest api upon initialization. when comes static pages, bit confused since still in learning stage.

question:

how configure backbone router serve static html pages under demo folder?

simple answer: don't.

the (simplified) way website (using backbone) works is:

  1. client requests page web server
  2. web server sends page (sometimes including backobne app)
  3. client receives web page, web browser renders page (executing backbone code, if any)
  4. backbone router handles hash changes , updates data on page (possibly making ajax requests), without ever requesting new page server

backbone doesn't static pages: client requests them (e.g. clicking on link), , web server sends them. in other words, follows steps above, stops @ step 3.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -