From 5f6a15767d9b27ca49ee8d1390480d3b845c057b Mon Sep 17 00:00:00 2001 From: Thiez-64 Date: Mon, 14 Jun 2021 11:26:33 +0200 Subject: [PATCH] Set up the project --- app.js | 15 +++++++++++++++ myapp.js | 0 node_modules/.package-lock.json | 8 ++++++++ package-lock.json | 14 ++++++++++++++ package.json | 1 + 5 files changed, 38 insertions(+) create mode 100644 app.js delete mode 100644 myapp.js diff --git a/app.js b/app.js new file mode 100644 index 0000000..700641b --- /dev/null +++ b/app.js @@ -0,0 +1,15 @@ +const express = require("express"); +const dotenv = require("dotenv"); +const app = express(); + +app.use(express.json()); + +app.get("/", (req, res) => { + res.status(200).json({ message: "hello-world" }); +}); + +const port = process.env.PORT || 4000; + +app.listen(port, () => { + console.log(`This app is served on port ${port}`); +}); diff --git a/myapp.js b/myapp.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 00702e4..c67af86 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -505,6 +505,14 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", diff --git a/package-lock.json b/package-lock.json index 77e7b7b..9fd8ec4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "dotenv": "^10.0.0", "express": "^4.17.1" }, "devDependencies": { @@ -513,6 +514,14 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, "node_modules/duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", @@ -2139,6 +2148,11 @@ "is-obj": "^2.0.0" } }, + "dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", diff --git a/package.json b/package.json index 83fcab0..c6f290a 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "dev": "nodemon app.js" }, "dependencies": { + "dotenv": "^10.0.0", "express": "^4.17.1" }, "devDependencies": {