D
D
deadkEEper12015-10-08 17:00:07
HTML
deadkEEper1, 2015-10-08 17:00:07

How to push html-page into response(SPA)?

The point is this. I'm trying to write SPA. If I understood correctly, then there should be one HTML file that we will send for each url request. And depending on the url - process, hide\open and fill the elements of the HTML file. So: while using index.html as the start page as a static file ( app.use(express.static(__dirname ))) everything worked fine. But when I decided to send it as a response to the start page

app.get('/', function(req, res, next){
  res.sendfile('index.html')
})
HTML itself loaded, but neither the css file, nor jquery, and even the file with scripts did not want to connect.
Structure:
[\public
\bower_components
\jquery
\dist
jquery.min.js]
app.js
index.html
sripts.js
style.css
I do not rule out (even most likely) that I am stupid and try to do it in an impossible way. Point out the error. Thank you)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question