Initial commit - Added basic HTTP server

This commit is contained in:
Pierre HUBERT 2019-01-19 08:24:49 +01:00
commit 42a1ad4182
3 changed files with 53 additions and 0 deletions

12
README.MD Normal file
View File

@ -0,0 +1,12 @@
# NodeSignalExchanger
A lightweight node application that allows to exchange signals connection through websockets.
## Requirements
```sh
sudo apt install nodejs node-express node-wc
```
## Author
Pierre HUBERT 2019

10
config.js Normal file
View File

@ -0,0 +1,10 @@
/**
* Project configuration
*
* @author Pierre HUBERT
*/
/**
* The port into which the server listen
*/
exports.port = 8081;

31
index.js Normal file
View File

@ -0,0 +1,31 @@
/**
* Project main module
*
* @author Pierre HUBERT
*/
/**
* Import requirements
*/
const express = require("express");
const app = express();
const WebSocket = require("ws");
/**
* Import project modules
*/
const config = require("./config");
/**
* If user tries to connect to home page,
* show a message to explains him what is the
* purpose of this service
*/
app.get("/", (req, res) => {
res.send("Welcome to NodeSignalExchanger!");
});
var server = app.listen(config.port, () => {
console.log("Application listening on port " + config.port);
})