- {typeof this.page === 'undefined' && !fetching ?
: null}
+ {typeof this.page === 'undefined' && !fetching ?
: null}
{this.page === 'post' && !fetching ? : null}
{fetching ? loadingElement : null}
diff --git a/client/js/redux/actions.js b/client/js/redux/actions.js
index 47adfdd..a191abd 100644
--- a/client/js/redux/actions.js
+++ b/client/js/redux/actions.js
@@ -2,6 +2,12 @@ import * as types from "./constants";
import marked from 'marked';
import 'whatwg-fetch';
+export function increasePostLimit(){
+ return {
+ type: types.INCREASE_POST_LIMIT
+ }
+}
+
function initPreview(posts) {
return {
type: types.INIT_PREVIEW,
diff --git a/client/js/redux/constants.js b/client/js/redux/constants.js
index d9cc693..6d21a68 100644
--- a/client/js/redux/constants.js
+++ b/client/js/redux/constants.js
@@ -2,4 +2,5 @@
export const INIT_PREVIEW = 'INIT_PREVIEW';
export const FILTER_PREVIEW = 'FILTER_PREVIEW';
export const LOAD_POST = 'LOAD_POST';
-export const FETCHING = 'FETCHING';
\ No newline at end of file
+export const FETCHING = 'FETCHING';
+export const INCREASE_POST_LIMIT = 'INCREASE_POST_LIMIT';
\ No newline at end of file
diff --git a/client/js/redux/reducers.js b/client/js/redux/reducers.js
index 37bfec8..ebf0d11 100644
--- a/client/js/redux/reducers.js
+++ b/client/js/redux/reducers.js
@@ -14,12 +14,10 @@ const defaultState = {
preview: {
posts: []
},
- filteredPreview: {
- posts: []
- },
post: "",
fetched: false,
- fetching: false
+ fetching: false,
+ postLimit: 10
};
//default reducer
@@ -32,10 +30,6 @@ function reducer(state = defaultState, action) {
fetched: true,
fetching: false
});
- case types.FILTER_PREVIEW:
- return Object.assign({}, state, {
- filteredPreview: Object.assign({}, state.filteredPreview, action.posts)
- });
case types.LOAD_POST:
return Object.assign({}, state, {
post: action.post,
@@ -47,6 +41,10 @@ function reducer(state = defaultState, action) {
fetched : false,
fetching: true
});
+ case types.INCREASE_POST_LIMIT:
+ return Object.assign({}, state, {
+ postLimit : state.postLimit + 10
+ });
}
//return present state if no actions get called
diff --git a/package.json b/package.json
index b0cfce2..e744041 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,9 @@
"build": "webpack && babel-node metadata.js",
"c9": "webpack-dev-server --port $PORT --host $IP --hot --content-base dist --history-api-fallback",
"dev": "webpack-dev-server --content-base public --inline --hot --history-api-fallback",
- "prod": "export NODE_ENV=production && webpack -p && babel-node metadata.js",
- "prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js"
+ "prod": "export NODE_ENV=production && webpack -p && babel-node metadata.js && go build",
+ "prod-win": "set NODE_ENV=production && webpack -p && babel-node metadata.js && go build",
+ "deploy" : "npm run prod && ./mywebsite"
},
"repository": {
"type": "git",
diff --git a/server.go b/server.go
index 9377d20..6199475 100644
--- a/server.go
+++ b/server.go
@@ -4,7 +4,8 @@ import (
"log"
"net/http"
"strconv"
-
+ "github.com/NYTimes/gziphandler"
+
//local import paths relative to app.yaml file
"mywebsite/server/controller/api"
"mywebsite/server/db"
@@ -34,7 +35,10 @@ func main(){
api.Configure(configurations.Api)
db.Mongo.Connect()
-
+
+ //register middleware
+ handle := gziphandler.GzipHandler(route.Routes())
+
log.Println("Starting Server...")
- log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), route.Routes()))
+ log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), handle))
}