From 8d84bdb2e6e458b4a61ab38b14342cdfa68215ba Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 12 Mar 2018 23:14:16 -0500 Subject: [PATCH] app/API build adjustments; get user from ctx --- .gitignore | 4 ++-- src/api/routes/handlers.go | 3 ++- src/app/config/index.js | 4 ++-- src/app/package.json | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index fe673e2..4e63cca 100644 --- a/.gitignore +++ b/.gitignore @@ -254,8 +254,8 @@ paket-files/ # Compiled files / application src/api/build -src/api/public/index.html -src/api/public/static +src/public/index.html +src/public/static src/config.json /build src/*.exe diff --git a/src/api/routes/handlers.go b/src/api/routes/handlers.go index 6d0e4d3..ee6a719 100644 --- a/src/api/routes/handlers.go +++ b/src/api/routes/handlers.go @@ -33,7 +33,8 @@ func sendJSON(w http.ResponseWriter, r *http.Request, result interface{}) { /* Handlers */ func journal(w http.ResponseWriter, r *http.Request, _ httprouter.Params, db *sql.DB) { - reqs := data.Journal(db, "TODO: get user ID") + user := r.Context().Value(ContextUserKey) + reqs := data.Journal(db, user.(string)) if reqs == nil { reqs = []data.JournalRequest{} } diff --git a/src/app/config/index.js b/src/app/config/index.js index 2333cd3..c6e5523 100644 --- a/src/app/config/index.js +++ b/src/app/config/index.js @@ -4,8 +4,8 @@ var path = require('path') module.exports = { build: { env: require('./prod.env'), - index: path.resolve(__dirname, '../../api/public/index.html'), - assetsRoot: path.resolve(__dirname, '../../api/public'), + index: path.resolve(__dirname, '../../public/index.html'), + assetsRoot: path.resolve(__dirname, '../../public'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: true, diff --git a/src/app/package.json b/src/app/package.json index ca5a2bf..a5e4424 100644 --- a/src/app/package.json +++ b/src/app/package.json @@ -11,7 +11,9 @@ "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", "e2e": "node test/e2e/runner.js", "test": "npm run unit && npm run e2e", - "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs" + "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs", + "apistart": "cd .. && go build -o mpj-api.exe && mpj-api.exe", + "vue": "node build/build.js prod && go build -o mpj-api.exe && mpj-api.exe" }, "dependencies": { "auth0-js": "^9.3.3",