Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nisaacson/hello-world-server
Super simple node.js server which listens on process.env["PORT"] and responds to all requests with "hello world\n"
https://github.com/nisaacson/hello-world-server
Last synced: about 1 month ago
JSON representation
Super simple node.js server which listens on process.env["PORT"] and responds to all requests with "hello world\n"
- Host: GitHub
- URL: https://github.com/nisaacson/hello-world-server
- Owner: nisaacson
- Created: 2013-07-22T22:46:45.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-08T15:55:34.000Z (over 10 years ago)
- Last Synced: 2024-04-14T14:46:39.893Z (7 months ago)
- Language: JavaScript
- Size: 1.26 MB
- Stars: 0
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Hello World Server
A very simple node.js http server.
# Port
The server looks for the following when determining the server port
* `--port ` command line flag
* `process.env["PORT"]`
* `3000` default# Response
The server responds to all requests with the content `"hello world\n"`# Installation
```bash
[sudo] npm install -g hello-world-server
```# Usage
Once the package is installed globally, you can start it on the command line
```bash
# start the server
hello-world-server
```To run on a
Then connect to the server to make sure it is running. You can visit [http://localhost:3000](http://localhost:3000) in your browser and you should see the text `"Hello World"` appear
Alternatively in the terminal you can use curl to connect to the server.
```bash
curl localhost:3000/
# you should receive "Hello World\n" back
```If you have changed the server port via `process.env["PORT"]` you will need to change the port in the examples above accordingly
# Docker & Vagrant
You can test this server using Vagrant and Docker.Builds a container to run a
# Usage
Pull down the image and run the default command
```bash
vagrant up
vagrant ssh
# pull existing image
docker pull nisaacson/hello-world-server
# or build it yourself
docker build $USER/hello-world-server .# run the server in detached mode
$PORT=4545
docker run -d -i -p 4000:4545 -e PORT=4545 -t nisaacson/hello-world-server:latest
# curl the server to make sure it is running...should get back "hello world\n"
curl localhost:$PORT
```