I've set up a node js server, and I'm having trouble accessing any files on my local server excluding the index.html file that I have explicitly linked to in my server.js file. How would I be able to access, for example some library files from my html page without recieving 404 errors?
Here is my file structure:
index.html
server.js
public/
--js/
----lib/
------ember-1.7.0.js
------ember-data.js
------handlebars-1.1.2.js
------jquery-1.10.2.js
------moment.js
------showdown.js
----router.js
Below is the updated content of my server.js file. The original problem was that I started working with express before I called my variables, so I didn't have access to the middleware. I still have an issue however. What am I doing wrong now?
/* Express 3 requires that you instantiate a `http.Server` to attach socket.io to first */
var express = require('express');
var http = require('http');
var path = require('path');
var port = 8080;
var app = express();
var server = http.createServer(app);
var url = 'http://localhost:' + port + '/';
if(process.env.SUBDOMAIN){
url = 'http://' + process.env.SUBDOMAIN + '.jit.su/';
}
server.listen(port);
console.log(url);
app.get('/', function (req, res) {
res.sendfile(__dirname + path.normalize('/index.html'));
});