Skip to content

Commit 7539348

Browse files
Updates to package.json
1 parent b98ea65 commit 7539348

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ logs
44
*.log
55
npm-debug.log*
66

7+
#distribution code
8+
dist
9+
710
# Runtime data
811
pids
912
*.pid

index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div>
3434

3535
<!-- application script -->
36-
<script src="/static/bundle.js"></script>
36+
<script src="/public/bundle.js"></script>
3737
<script>
3838
/*make all ajax calls pass the CSRF token via a header back to the client*/
3939
$.ajaxSetup({

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
"name": "redux-todos-example",
33
"version": "0.0.0",
44
"description": "Redux Todos example",
5+
"engines": {
6+
"node": "6.0.0"
7+
},
58
"scripts": {
69
"start": "node server.js",
10+
"prestart": "npm run bundle",
11+
"postinstall": "webpack --config webpack.config.js",
12+
"bundle": "webpack --config webpack.config.js",
713
"test": "cross-env NODE_ENV=test mocha --recursive --compilers js:babel-register --require ./test/setup.js",
814
"test:watch": "npm test -- --watch"
915
},
@@ -17,12 +23,15 @@
1723
},
1824
"homepage": "http://redux.js.org",
1925
"dependencies": {
26+
"babel": "^6.5.2",
2027
"babel-polyfill": "^6.3.14",
2128
"body-parser": "^1.15.2",
2229
"cookie-parser": "^1.4.3",
2330
"cookie-session": "^2.0.0-alpha.1",
2431
"csurf": "^1.9.0",
2532
"ejs": "^2.5.1",
33+
"express": "^4.14.0",
34+
"express-winston": "^2.0.0",
2635
"graceful-fs": "^4.1.4",
2736
"react-bootstrap": "^0.29.5",
2837
"react-bootstrap-table": "^2.3.7",
@@ -31,7 +40,13 @@
3140
"redux": "^3.1.2",
3241
"redux-logger": "^2.6.1",
3342
"redux-thunk": "^2.1.0",
34-
"wepay": "0.0.5"
43+
"request": "^2.74.0",
44+
"url": "^0.11.0",
45+
"webpack": "^1.13.1",
46+
"webpack-dev-middleware": "^1.6.1",
47+
"webpack-hot-middleware": "^2.12.2",
48+
"wepay": "0.0.5",
49+
"winston": "^2.2.0"
3550
},
3651
"devDependencies": {
3752
"babel-core": "^6.3.15",

server.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var WePay = require("wepay").WEPAY;
1212

1313
// HTTPS server
1414
var https = require("https")
15-
var http = require("http")
15+
var http = require("http");
1616

1717
// file reader
1818
var fs = require("fs")
@@ -38,8 +38,8 @@ var cookieParser = require("cookie-parser")
3838
var csrf = require("csurf");
3939
var csrfProtection = csrf(
4040
{cookie:{
41-
secure:true,
42-
httpOnly:true
41+
secure:app_config.httpOverride ? false : true,
42+
httpOnly: true
4343
}
4444
}
4545
);
@@ -439,12 +439,16 @@ app.post("/credit_card", csrfProtection, function(req, res){
439439
* Before we start, make sure that the app configuration meets the requirements
440440
*/
441441
verifyConfig(app_config);
442-
443-
var httpsServer = https.createServer(credentials, app);
444-
httpsServer.listen(port, function(error) {
442+
if (app_config.httpOverride) {
443+
var httpsServer = http.createServer(app);
444+
}
445+
else {
446+
var httpsServer = https.createServer(credentials, app);
447+
}
448+
httpsServer.listen(process.env.PORT || '8080', function(error) {
445449
if (error) {
446450
console.error(error)
447451
} else {
448-
console.info("==> 🌎 Listening on port %s. Open up https://localhost:%s/ in your browser.", port, port)
452+
console.info("==> 🌎 Listening on port %s. Open up https://localhost:%s/ in your browser.", process.env.PORT || '8080', process.env.PORT || '8080')
449453
}
450454
});

webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
output: {
1111
path: path.join(__dirname, 'dist'),
1212
filename: 'bundle.js',
13-
publicPath: '/static/'
13+
publicPath: '/public/'
1414
},
1515
plugins: [
1616
new webpack.optimize.OccurrenceOrderPlugin(),
@@ -26,4 +26,4 @@ module.exports = {
2626
}
2727
]
2828
}
29-
}
29+
}

0 commit comments

Comments
 (0)