From 62af6f5442601f54de40ffa17b6da822861e6d7f Mon Sep 17 00:00:00 2001 From: xrazis Date: Mon, 8 Jun 2020 14:47:40 +0000 Subject: [PATCH] init nodejs --- hello_world/app.js | 16 ++++++++++++++++ hello_world/package.json | 13 +++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 hello_world/app.js create mode 100644 hello_world/package.json diff --git a/hello_world/app.js b/hello_world/app.js new file mode 100644 index 0000000..272cd9d --- /dev/null +++ b/hello_world/app.js @@ -0,0 +1,16 @@ +'use strict'; + +const express = require('express'); + +// Constants +const PORT = 3000; +const HOST = '0.0.0.0'; + +// App +const app = express(); +app.get('/', (req, res) => { + res.send('Hello World'); +}); + +app.listen(PORT, HOST); +console.log(`Running on http://${HOST}:${PORT}`); diff --git a/hello_world/package.json b/hello_world/package.json new file mode 100644 index 0000000..95a6970 --- /dev/null +++ b/hello_world/package.json @@ -0,0 +1,13 @@ +{ + "name": "docker_web_app", + "version": "1.0.0", + "description": "Node.js on Docker", + "author": "First Last ", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "dependencies": { + "express": "^4.16.1" + } +}