Skip to content

Commit

Permalink
Merge pull request #6 from Scharkee/production-server-fix
Browse files Browse the repository at this point in the history
Production server fix
  • Loading branch information
rastenis committed Jul 26, 2019
2 parents 00ae234 + b250157 commit b46652f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"scripts": {
"dev": "node src/server.js",
"build": "nuxt build",
"start": "nuxt start",
"prod": "nuxt build && nuxt start",
"start": "NODE_ENV=production node src/server.js",
"launch": "nuxt build && npm run start",
"precommit": "npm run lint",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
"test": "ava --serial --verbose",
Expand Down
1 change: 1 addition & 0 deletions pages/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<script>
import axios from "axios";
export default {
name: "id",
asyncData({ params, error }) {
Expand Down
1 change: 1 addition & 0 deletions pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<script>
import axios from "axios";
export default {
head() {
return {
Expand Down
1 change: 1 addition & 0 deletions pages/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<script>
import axios from "axios";
export default {
head() {
return {
Expand Down
1 change: 1 addition & 0 deletions pages/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<script>
import axios from "axios";
export default {
head() {
return {
Expand Down
9 changes: 4 additions & 5 deletions config/passportConfig.js → src/passport/passportConfig.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
require("dotenv").config();
const passport = require("passport");
const { Strategy: LocalStrategy } = require("passport-local");
const { Strategy: TwitterStrategy } = require("passport-twitter");
const { OAuth2Strategy: GoogleStrategy } = require("passport-google-oauth");

const db = require("../src/external/db.js");
const keysConf = require("../config/passportKeys.json");
const User = require("../src/controllers/user.js");
const config = require("./config.json");
const db = require("../external/db.js");
const keysConf = require("../../config/passportKeys.json");
const User = require("../controllers/user.js");
const config = require("../../config/config.json");

passport.serializeUser((user, done) => done(null, user.data._id));

Expand Down
8 changes: 4 additions & 4 deletions src/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// deps
"use strict";
process.env.DEBUG = process.env.NODE_ENV === "production" ? "" : "nuxt:*";
const { Nuxt, Builder } = require("nuxt");
const bodyParser = require("body-parser");
Expand Down Expand Up @@ -29,7 +29,7 @@ const config = require("../config/config.json");
/*
Passport configuration.
*/
const passportConfig = require("../config/passportConfig.js");
const passportConfig = require("./passport/passportConfig.js");

/*
The user model
Expand Down Expand Up @@ -400,12 +400,12 @@ const nuxtConfig = require("../nuxt.config.js");

nuxtConfig.dev = process.env.NODE_ENV !== "production";
const nuxt = new Nuxt(nuxtConfig);

// serving nuxt in devmode
if (nuxtConfig.dev) {
const builder = new Builder(nuxt);
builder.build();
}
// No build in production
// serving nuxt
app.use(nuxt.render);

/*
Expand Down
1 change: 0 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ test("Login again", async t => {
});

test("Delete account", async t => {
console.log(email);
try {
const { data } = await ax({
method: "post",
Expand Down

0 comments on commit b46652f

Please sign in to comment.