Source: app.js

/**
 * @file
 *
 * Summary.
 * <p>Draw a clock using the canvas API from HTML5.</p>
 *
 *  Description. 
 *  <p> Uses nodejs and express to start a web server and send an html page and a javascript file to the client. <br>
 *      - Advantages: no need for an apache server.  
 *  </p>
 * 
 *  <pre>
 *  Documentation:
 *  - Ubuntu:
 *     - sudo apt install jsdoc-toolkit
 *  - MacOS:
 *     - sudo port install npm6 (or npm7)
 *     - sudo npm install -g jsdoc
 *     - npm install express
 *  - jsdoc -d docjs app.js
 *  - node app.js &
 *  </pre>
 *
 *  @see http://localhost:3000
 *  @see https://www.techiediaries.com/express-sendfile-serve-static-files/
 *  @see https://dev.to/kyorkston/making-an-html5-canvas-app-using-express-431l
 *  @see http://expressjs.com/en/api.html
 *  @see https://nodejs.dev/learn/update-all-the-nodejs-dependencies-to-their-latest-version
 *  @see https://nodejs.org/api/process.html#process_process_env
 *  @author Paulo Roma Cavalcanti
 *  @since 22/04/2021
 */


const express = require('express')

const app = express();
const port = process.env.PORT || 3000;  // global process module 
const hostname = '0.0.0.0';             // server will run on all interfaces available

app.use(express.static(__dirname + '/src'))

app.get('/', (req, res) => res.sendFile('index.html'))

app.listen(port, hostname => console.log(`App listening on port ${port}`))