I ran

```
node src/app.js

```

in the mean-to directory

```
express.static('public') 

```

would work,why?

don't need to specify the path?

what's the rule?

and I know

```
__dirname+'/../public'` 

```

works just fine.

[![enter image description here](https://i.stack.imgur.com/Y8AHt.png)](https://i.stack.imgur.com/Y8AHt.png)

---

Just want to make sure the the logic here

I look up the doc
<http://expressjs.com/en/starter/static-files.html>

it says

> 
> "Pass the name of the directory that contains the static assets to the express.static middleware function to start serving the files directly. "
> 
> 
> "the path that you provide to the express.static function is ***relative to the directory from where you launch your node process***"
> 
> 
> 

Does that mean

1. if I run **node src/app.js** in *mean-to folder* --> use express.static('public')
2. if I run **node app.js** in *src folder* => use express.static('../public')

and for safety, better use **\_\_dirname** to get the absolute path of the directory