Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Adding Sectional Comments and Formatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
Reydescel Rodriguez committed Feb 27, 2021
1 parent 763a61b commit a45fc49
Showing 1 changed file with 66 additions and 24 deletions.
90 changes: 66 additions & 24 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,87 @@
var express = require("express");
const { exec } = require("child_process");
var path = require('path');
/**
* Module Dependencies
*/
const express = require('express');
const path = require('path');
const { exec } = require('child_process');

/**
* Server Settings
*/
var app = express();
var port = 8000;

app.set('port', port);

/**
* Serving Static Files
*/
app.use(express.static(path.join(__dirname, 'site/html')));
app.use('/server/vital', express.static(path.join(__dirname, 'vital/public')));
app.use('/pages/', express.static(path.join(__dirname, 'vital/pages')))
app.use(function(req, res, next) {
res.status(404);
res.sendFile(path.join(__dirname, 'vital', '404.html'));
});

app.use('/pages/', express.static(path.join(__dirname, 'vital/pages')));

app.listen(port);
console.log(`Now listening on port ${port}`);
console.log(`Go to http://localhost:${port}`);
/**
* Handling 404 Errors and Displaying 404 Page
*/
app.use(function (req, res, next) {
res.status(404);
res.sendFile(path.join(__dirname, 'vital', '404.html'));
});

exec("node index.js", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
console.log(`stdout: ${stdout}`);
/**
* Server listening
*/
app.listen(app.get('port'), function () {
console.log(`
Now listening on port ${port}
Go to http://localhost:${port}
`);
});

function site(){
exec("npm run convert", (error, stdout, stderr) => {
/**
* TODO: Add the description of this function
* [exec description]
* @param {[type]} error [description]
* @param {[type]} stdout [description]
* @param {[type]} stderr [description]
*/
exec('node index.js', (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}

if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}

console.log(`stdout: ${stdout}`);
});

/**
* TODO: Add the description of this function
* [site description]
* [exec description]
* @param {[type]} error [description]
* @param {[type]} stdout [description]
* @param {[type]} stderr [description]
*/
function site() {
exec('npm run convert', (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}

if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}

console.log(`stdout: ${stdout}`);
});
}

site();
setInterval(site, 600000);

0 comments on commit a45fc49

Please sign in to comment.