]> git.cworth.org Git - lmno-server/commitdiff
Add Hello World node app
authorCarl Worth <cworth@cworth.org>
Sun, 26 Apr 2020 21:55:34 +0000 (14:55 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 26 Apr 2020 21:55:34 +0000 (14:55 -0700)
This is similar to what is documented here:

https://medium.com/@adnanrahic/hello-world-app-with-node-js-and-express-c1eb7cfa8a30

but with some more modern content as recommended by Richard.

This can be run with:

node server

in the current directory, (and then pointing a user agent at localhost:3000).

server.js [new file with mode: 0644]

diff --git a/server.js b/server.js
new file mode 100644 (file)
index 0000000..d66ca29
--- /dev/null
+++ b/server.js
@@ -0,0 +1,11 @@
+const express = require("express")
+
+const app = express();
+
+app.get('/', function (req, res) {
+  res.send('Hello World!');
+});
+
+app.listen(3000, function () {
+  console.log('Example app listening on port 3000!');
+});