An example of Socket.io with Node.Js on the beagle bone or Raspberry
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
771 B

3 years ago
  1. # Readme
  2. This repository guides you to implement a server using Node.js. A first instance is created to understand how to set a server, then the server code is used to read the contents and printed out. Finally, a new server instance is prepared to prepare an `index.html` page and change dynamically its contents and LED status by reading the status option selected by the user.
  3. ## Static server
  4. A static server is developed on static-server.js file:
  5. ```node
  6. const express = require("express");
  7. const app = express();
  8. const http = require("http");
  9. const server = http.createServer(app);
  10. app.get('/', (req, res)=>{
  11. res.send('<h1> Hello World</h1>');
  12. });
  13. server.listen(4040, ()=>{
  14. console.log('listen on http://beaglebone-black.local:4040');
  15. });
  16. ```