Giter VIP home page Giter VIP logo

expresshttp's Introduction

ExpressHTTP :shipit:

GitHub Workflow Status GitHub top language Docker Pulls GitHub last commit Lines of code License

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.

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 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.

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)

expresshttp's People

Contributors

bsord avatar dependabot-preview[bot] avatar jonfairbanks avatar

Watchers

 avatar  avatar  avatar

Forkers

bsord

expresshttp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.