diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0e0dcd2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/bin/www b/bin/www index de525b7..4165d01 100644 --- a/bin/www +++ b/bin/www @@ -1,34 +1,38 @@ -#!/usr/bin/env node +#!/usr/bin/env node // to invoke node, in linux system, that is installed in a path accessed through the environment variable /** * Module dependencies. + * Everything starts here */ -var app = require('../app'); +var app = require('../app'); // call app.js that will call routes throught ../routes/index.js var debug = require('debug')('pg-node:server'); var http = require('http'); -// /** -// * Production verification -// */ -// var express = require("express"); -// if (process.env.NODE_ENV === 'production') { -// // Express will serve up production assets -// // like our main.js file, or main.css file! -// app.use(express.static('../client/build')); - -// // Express will serve up the index.html file -// // if it doesn't recognize the route -// const path = require('path'); -// app.get('*', (req, res) => { -// res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html')); -// }); -// } +/** + * Production version verification. It needs to build for React client. + */ +var express = require("express"); +if (process.env.NODE_ENV === 'production') { + // Express will serve up production assets + // like our main.js file or main.css file! + // this guarantees that expressjs will look + // for specific files in specific directories + 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 + + // Express will serve up the index.html file + // if it doesn't recognize the route. + // If something arrives from a route that we do not understand, + // look at the index.htm file in the client directory + const path = require('path'); + app.get('*', (req, res) => { + res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html')); + }); +} /** * Define port */ - var port = normalizePort(process.env.PORT || '5000'); app.set('port', port); diff --git a/client/package.json b/client/package.json index fce0819..525ee3e 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "client", - "version": "0.7.0", + "version": "0.7.1", "private": true, "proxy": { "/map": { diff --git a/client/public/index.html b/client/public/index.html index 6d11109..423331f 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -1,24 +1,12 @@ +
- -