2017-01-09 20:45:12 +00:00
# tstatic [![CircleCI](https://circleci.com/gh/RealOrangeOne/tstatic/tree/master.svg?style=svg)](https://circleci.com/gh/RealOrangeOne/tstatic/tree/master)
2017-01-21 23:15:59 +00:00
The only static-file server you'll ever need!
2016-05-16 13:20:30 +01:00
2017-01-21 23:15:59 +00:00
### Features:
- Logging
- Basic-Auth _(optional)_
- Custom 404 page
- Optimum Compression - [`compression` ](https://www.npmjs.com/package/compression )
- Security checks / headers - [`helmet` ](https://www.npmjs.com/package/helmet )
- Opbeat error-reporting - [docs ](https://opbeat.com/docs/articles/get-started-with-express/ )
2016-05-16 13:20:30 +01:00
2017-01-21 23:15:59 +00:00
### Usage / Configuration
```bash
tstatic < directory >
```
`directory` is where your static files are.
2016-05-16 13:20:30 +01:00
2017-01-21 23:15:59 +00:00
404 errors will return with `<directory>/.404.html` , with status code 404. If this file doesnt exist, plain error page will be shown.
2016-05-16 13:20:30 +01:00
2017-01-21 23:15:59 +00:00
#### Environment
Make sure to set `NODE_ENV` to `production` !
`PORT` : The port you want the server to listen on. Default: `5000` .
`BASIC_AUTH_USERNAME` / `BASIC_AUTH_PASSWORD` : Credentials for built-in basic auth
Opbeat middleware is configured using documented variables [here ](https://opbeat.com/docs/articles/opbeat-for-nodejs-api/#appid ). _Requires production `NODE_ENV` !_
2016-05-16 13:20:30 +01:00