Compare View

switch
from
...
to
 
Commits (3)
... ... @@ -1,112 +0,0 @@
1   -#!/usr/bin/env node // to invoke node, in linux system, that is installed in a path accessed through the environment variable
2   -
3   -/**
4   - * Module dependencies.
5   - * Everything starts here
6   - */
7   -
8   -var app = require('./app'); // call app.js that will call routes throught ../routes/index.js
9   -var debug = require('debug')('pg-node:server');
10   -// var http = require('http');
11   -
12   -/**
13   - * Production version verification. It needs to build for React client.
14   - */
15   -var express = require("express");
16   -if (process.env.NODE_ENV === 'production') {
17   - // Express will serve up production assets
18   - // like our main.js file or main.css file!
19   - // this guarantees that expressjs will look
20   - // for specific files in specific directories
21   - console.log ("NEXUS-We are in production...");
22   - app.use(express.static('./client/build')); // if get request comes in from some route or some file or for anything for my application and we do not understant, then look in some file from this directory to see if some file that matches up the request
23   -
24   - // Express will serve up the index.html file
25   - // if it doesn't recognize the route.
26   - // If something arrives from a route that we do not understand,
27   - // look at the index.htm file in the client directory
28   - const path = require('path');
29   - app.get('*', (req, res) => {
30   - res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
31   - });
32   -}
33   -
34   -/**
35   - * Define port
36   - */
37   -var port = normalizePort(process.env.PORT || '5000');
38   -app.listen(port);
39   -
40   -/**
41   - * Create HTTP server.
42   - */
43   -
44   -// var server = http.createServer(app);
45   -
46   -/**
47   - * Listen on provided port, on all network interfaces.
48   - */
49   -
50   -// server.listen(port);
51   -// server.on('error', onError);
52   -// server.on('listening', onListening);
53   -
54   -/**
55   - * Normalize a port into a number, string, or false.
56   - */
57   -
58   -function normalizePort(val) {
59   - var port = parseInt(val, 10);
60   -
61   - if (isNaN(port)) {
62   - // named pipe
63   - return val;
64   - }
65   -
66   - if (port >= 0) {
67   - // port number
68   - return port;
69   - }
70   -
71   - return false;
72   -}
73   -
74   -/**
75   - * Event listener for HTTP server "error" event.
76   - */
77   -
78   -function onError(error) {
79   - if (error.syscall !== 'listen') {
80   - throw error;
81   - }
82   -
83   - var bind = typeof port === 'string'
84   - ? 'Pipe ' + port
85   - : 'Port ' + port;
86   -
87   - // handle specific listen errors with friendly messages
88   - switch (error.code) {
89   - case 'EACCES':
90   - console.error(bind + ' requires elevated privileges');
91   - process.exit(1);
92   - break;
93   - case 'EADDRINUSE':
94   - console.error(bind + ' is already in use');
95   - process.exit(1);
96   - break;
97   - default:
98   - throw error;
99   - }
100   -}
101   -
102   -/**
103   - * Event listener for HTTP server "listening" event.
104   - */
105   -
106   -// function onListening() {
107   -// var addr = server.address();
108   -// var bind = typeof addr === 'string'
109   -// ? 'pipe ' + addr
110   -// : 'port ' + addr.port;
111   -// debug('Listening on ' + bind);
112   -// }