diff --git a/Readme.md b/Readme.md index 3751971..675f3d2 100644 --- a/Readme.md +++ b/Readme.md @@ -19,3 +19,22 @@ server.listen(4040, ()=>{ }); ``` +## Server information on a html file + +```node +const express = require("express"); +const app = express(); +const http = require("http"); +const server = http.createServer(app); + +app.get('/', (req, res)=>{ + res.sendFile(__dirname + '/index-static.html'); + //res.send('

Hello World

'); +}); + +server.listen(4040, ()=>{ + console.log('listen on http://beaglebone-black.local:4040'); +}); +``` +the contents of the .html file is a common file. + diff --git a/file-server.js b/file-server.js new file mode 100644 index 0000000..da894b3 --- /dev/null +++ b/file-server.js @@ -0,0 +1,13 @@ +const express = require("express"); +const app = express(); +const http = require("http"); +const server = http.createServer(app); + +app.get('/', (req, res)=>{ + res.sendFile(__dirname + '/index-static.html'); + //res.send('

Hello World

'); +}); + +server.listen(4040, ()=>{ + console.log('listen on http://beaglebone-black.local:4040'); +}); diff --git a/index-static.html b/index-static.html new file mode 100644 index 0000000..150e617 --- /dev/null +++ b/index-static.html @@ -0,0 +1,2 @@ +

Hello World

+Here we are in my Beagle