http-ephemeral-server v0.1.0
http-ephemeral-server
Ephemeral Node.js HTTP application for investigation.
http-ephemeral-server is a simple, single-featured HTTP server.
It shows details of current request, cookies, and server environments available via Node.js process.
Installing globally
Installation via npm:
$ npm install http-ephemeral-server -gThis will install http-ephemeral-server globally so that it may be run from the command line.
Usage
$ http-ephemeral-serveror a short-hand command:
$ hesNow you can visit http://localhost:3000
Listening port by default is 3000.
You can change the listening port by specifying environment variable PORT:
$ PORT=8000 http-ephemeral-serverNow your url has changed to http://localhost:8000
Docker support
http-ephemeral-server is a suitable solution when you need a simple web server running on Docker.
Usage
Clone this repository localy, then:
$ git clone https://github.com/kulikala/http-ephemeral-server.git
$ cd http-ephemeral-serverBuild a Docker image with docker command:
$ docker image build -t http-ephemeral-server:latest .By default, the built image contains PORT=80 environment variable and exposes port 80 to local Docker network.
You can pass --build-arg to change this port number:
$ docker image build -t http-ephemeral-server:latest --build-arg PORT=3000 .This will build an image with environment variable with PORT=3000 and EXPOSE 3000.
Now you can run the image:
$ docker container run -d http-ephemeral-server:latestOpen browser and visit http://localhost:3000 to view your container
You can change exposing port by passing PORT environment variable when you run the image:
$ docker container run -d -p 8000:8000 -e PORT=8000 http-ephemeral-server:latestNow your url has changed to http://localhost:8000
If you prefer to use docker-compose instead, refer to docker-compose.yml in the root directory.
$ docker-compose build
$ docker-compose startUsing as a dependent package
Installation via npm:
$ npm install http-ephemeral-server --saverequire('http-ephemeral-server') returns an Express Application.
const app = require('http-ephemeral-server')
app.listen(3000)Now your server is listening on 3000
License
MIT
8 years ago