An open API service indexing awesome lists of open source software.

https://github.com/lrusso/webserver

Simple Node.js Web server with SSL support
https://github.com/lrusso/webserver

js node server simple ssl web

Last synced: about 1 month ago
JSON representation

Simple Node.js Web server with SSL support

Awesome Lists containing this project

README

          

# Simple Node.js Web Server

Simple Node.js Web server with SSL support.

## Running the Web server

* Standard ports: ```node server.js```
* Customs ports: ```node server.js 8080 4430```

## Workaround for browsing to localhost using SSL

1. Run ```node server.js```
2. Open Chrome and browse to ```https://localhost```
3. Click on ```ADVANCED```
4. Click on ```Proceed to localhost (unsafe)```

This workaround is useful for testing purposes because, for example, a Web App may require access to the webcam and that is not allowed using a non-secure connection.

## Running the Web server in the background

1. Install Forever: ```npm install -g forever```
2. Start the server: ```forever start -a -l /dev/null -c node server.js > /dev/null 2>&1```
3. Stop the server: ```forever stop -a -l /dev/null -c node server.js > /dev/null 2>&1```

## How to launch the server on startup (macOS)

- Run `nano ~/Library/LaunchAgents/com.lrusso.server.plist`
- Assuming that you have the server folder path in `/Users/lrusso/Server`, paste the following code:

```xml

Label
com.lrusso.server

ProgramArguments

/usr/local/bin/node
/Users/lrusso/Server/server.js

WorkingDirectory
/Users/lrusso/Server

EnvironmentVariables

PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin

RunAtLoad

KeepAlive

StandardErrorPath
/dev/null
StandardOutPath
/dev/null

```

- Run `chmod 644 ~/Library/LaunchAgents/com.lrusso.server.plist`
- Run `launchctl load ~/Library/LaunchAgents/com.lrusso.server.plist`