Human Cyborg Relations Human Cyborg Relations - 24 days ago 10
CSS Question

Status code 304 (Jade, Node, Express)

I'm linking bootstrap and jquery in my jade file,

link(rel='stylesheet', href='/stylesheets/bootstrap.css')


and

script(src='/javascripts/jquery-3.1.1.js')
script(src='/javascripts/bootstrap.js')


This Jade file is in my views folder.
The boostrap css is in my public/stylesheets folder and the javascript is in the public/javascripts folder.

When I run my application using nodemon, it says

GET / 200 80ms - 1.65kb
GET /stylesheets/bootstrap.css 304 1ms
GET /javascripts/jquery-3.1.1.js 304 3
GET /javascripts/bootstrap.js 304 2ms


The javascript and css files do not load up.

Suggestions?

Answer

304 Not Modified

If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.

Server sent 304 http status to the client (browser) letting it the file is not modified since the browser last received the copy of the file with 200 status code. When this happens, usually browser should have cached copy of the files and will load the same from the cache.

Better, clear all your browser cache by deleting all temporary files, histories etc and close and reopen (restart) your browser.

Reload the page and check the status code again in nodemon. It should be 200 this time.