foxd27 technical documentation Buy

Installing nodejs on FOX D27

Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Nodejs version 18.13.0 is already installed on the MicroSD image available on this repository:

Example of basic web server

Save this example code in a file called webserver.js:

const http = require('http');

const hostname = '';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);

Then run it:

node webserver.js

Open the web url http://acme_board_ip_address:3000 on a browser on your PC to see the web server message generated by this example.

Install Express JS

npm install express

Express example:

const express = require('express')
const app = express()

app.get('/', (req, res) => {
  res.send('Hello World!')

        3000, '',
        () => console.log(`Server listening on port 3000.`)

Home page foxd27 technical documentation Buy