commit 42a1ad4182541de9bb03b50205e8c3c244aa9b47 Author: Pierre HUBERT Date: Sat Jan 19 08:24:49 2019 +0100 Initial commit - Added basic HTTP server diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..146ed2b --- /dev/null +++ b/README.MD @@ -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 \ No newline at end of file diff --git a/config.js b/config.js new file mode 100644 index 0000000..b5fd87d --- /dev/null +++ b/config.js @@ -0,0 +1,10 @@ +/** + * Project configuration + * + * @author Pierre HUBERT + */ + +/** + * The port into which the server listen + */ +exports.port = 8081; \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..d0c4467 --- /dev/null +++ b/index.js @@ -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); +}) \ No newline at end of file