Question: I'm currently experiencing some minor problems with serving static files through expressJs.

My directory structure is as following:

* public
	+ css
	+ lib
* src
	+ views
	+ home
		- index.html
	+ server.js

In my `index.html` file i have prefixed all my assets with a leading slash.

My static setup is as following:
`app.use(express.static(path.resolve(__dirname + '../' + 'public')));`

But for some reason my static files are not getting served.

I was thinking that this is a crossdomain call or something...
I'm currently using cloud9 IDE, might this have to do with it somehow?

Answer: 
You should use [path.join](http://nodejs.org/api/path.html#path_path_join_path1_path2) instead of manually concatening path components. It uses [path.normalize](http://nodejs.org/api/path.html#path_path_normalize_p), which resolves `.` and `..`, handles multiple or trailing slashes, and uses the appropriate file separator for your platform (see: [path.sep](http://nodejs.org/api/path.html#path_path_sep)).

For example,

```
var path = require('path');

var express = require('express');

var app = express();

app.use(express.static(path.join(__dirname, '../public')));

```
`__dirname` doesn't have a trailing slash, so `__dirname + '../'` results in `DIRNAME../` (which isn't valid).

Instead, use:

```
__dirname + '/../public'
             ^ extra slash

```