https://github.com/jonfairbanks/expresshttp
Express HTTP File Server with Lusca and DDoS Rate Limiting
https://github.com/jonfairbanks/expresshttp
express express-server file-server http-server https-server
Last synced: about 1 month ago
JSON representation
Express HTTP File Server with Lusca and DDoS Rate Limiting
- Host: GitHub
- URL: https://github.com/jonfairbanks/expresshttp
- Owner: jonfairbanks
- License: mit
- Created: 2018-07-13T04:58:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T21:11:04.000Z (almost 3 years ago)
- Last Synced: 2025-01-11T01:39:40.423Z (12 months ago)
- Topics: express, express-server, file-server, http-server, https-server
- Language: JavaScript
- Homepage: https://hub.docker.com/r/jonfairbanks/expresshttp
- Size: 867 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ExpressHTTP :shipit:
![GitHub Workflow Status]()





Express HTTP File Server with Helmet and DDoS Rate Limiting
#### Prerequisites
- Node v10+
- A Redis instance: `docker run --name redis -d -p 6379:6379 redis`
#### Quick Start
- Fetch the code using git or wget
- While in the app directory run `npm install` to setup
- Once complete, run `npm start` to launch the server
- Load files into the **public/** directory
- Navigate to :8080/ in your browser
_[Optional] To keep ExpressHTTP up and running behind the scenes, checkout [PM2](http://pm2.keymetrics.io/ 'PM2')._
#### Production Support
To properly enable session support in ExpressHTTP, you must utilize a Redis instance. By default ExpressHTTP connects to a Redis instance running on the localhost when the app is launched in `production` mode. To override these settings, see the [Config Options](#Config-Options) below.
To setup a Redis instance if you do not have one running already: `docker run --name redis -d -p 6379:6379 redis`
Finally, run ExpressHTTP in `production` mode: `NODE_ENV=production npm start`
#### Running with Docker
ExpressHTTP is also available on [DockerHub](https://hub.docker.com/r/jonfairbanks/expresshttp).
Before Docker setup, ensure Redis is running and finally run the following command:
`docker run -d -p 8080:8080 -e REDIS_HOST=1.2.3.4 -v ~/ExpressHTTP/public:/app/public --name ExpressHTTP --restart=always jonfairbanks/expresshttp`
#### Config Options
The following options can be passed in at runtime as ENV variables:
- `SESSION_SECRET`: Either a string or array of secrets used to sign the session ID cookie
- If array is passed -- the first secret is to sign, other secrets are used to verify
- `LOGGING`: If **true**, an access.log will be created for incoming site requests using Morgan logging
- `RATE_LIMIT`: If **true**, enables DDoS and RateLimit protections through Express
- `SITE_ROOT`: Override the default path files are served from (default: /public)
- `PORT`: Override the default address the ExpressHTTP app is served from (default: 8080)
- `REDIS`: If **true**, Express sessions will be saved in Redis (ideal for production)
- `REDIS_HOST`: Override the default address used to connect to Redis (default: 127.0.0.1)
- `REDIS_PORT`: Override the default port used to connect to Redis (default: 6370)