2

I have a very very simple node server, which has one task : serve an HTML file corresponding to the entry point of my AngularJS app.

But I have a problem : I have no cache for static resources, as JS or CSS files. How could I achieve it ? Is it a node or angular problem ?

1
  • you should just google 'simple node server' or 'static node server' Commented Apr 29, 2015 at 3:14

1 Answer 1

4

AngularJS is a client-side framework, and has little to do with the serving of files. Can you not just use Express like this:

var express = require('express');
var app = express();

app.use(express.static(__dirname + '/public'));

app.listen(process.env.PORT || 3000);

As a side note, it may be more useful to serve static files with something like Nginx.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.