Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit 13a230d

Browse files
authored
Merge pull request #118 from gsdstr/webpack4
css and connection fix
2 parents e932575 + 8386113 commit 13a230d

File tree

18 files changed

+1193
-74384
lines changed

18 files changed

+1193
-74384
lines changed

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<img src="http://vuejs.org/images/logo.png" height="50"> <img src="https://coligo.io/images/express.svg" height="50"> <img src="https://upload.wikimedia.org/wikipedia/en/thumb/4/45/MongoDB-Logo.svg/527px-MongoDB-Logo.svg.png" height="50"> <img src="https://worldvectorlogo.com/logos/nodejs-icon.svg" height="50"> <img src="https://camo.githubusercontent.com/66747a6e05a799aec9c6e04a3e721ca567748e8b/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313336353838312f313931383337332f32653035373166612d376462632d313165332d383436352d3839356632393164343366652e706e67" height="50">
44

55
[![Known Vulnerabilities](https://snyk.io/test/github/icebob/vue-express-mongo-boilerplate/badge.svg)](https://snyk.io/test/github/icebob/vue-express-mongo-boilerplate)
6-
![Node 6](https://img.shields.io/badge/node-6.x.x-green.svg)
6+
![Node 10](https://img.shields.io/badge/node-10.x.x-green.svg)
77
![VueJS 2](https://img.shields.io/badge/vuejs-2.3.x-green.svg)
8-
![Webpack 2](https://img.shields.io/badge/webpack-2.6.x-green.svg)
8+
![Webpack 4](https://img.shields.io/badge/webpack-4.17.x-green.svg)
99

1010
This is a full stack webapp boilerplate project with VueJS + ExpressJS + MongoDB. It is NOT an out-of-box project.
1111
I make it in order to create an up-to-date starter repo which contains all important functions (user signup, login, oauth, profile, ...etc) except the business-logic. So when neccessary I can create a new webapp and only need to develop the business logic.
@@ -20,7 +20,7 @@ Inspired by [dstroot/skeleton](https://github.com/dstroot/skeleton) and [sahat/h
2020
## Features
2121

2222
**Server-side**
23-
* [x] **[Node.JS](https://nodejs.org)** v6.x.x
23+
* [x] **[Node.JS](https://nodejs.org)** v10.x.x
2424
* [x] **[Express](https://github.com/expressjs/express)**
2525
* [x] [MongoDB](https://www.mongodb.com/) with [Mongoose](https://github.com/Automattic/mongoose)
2626
* [x] [NodeMailer](https://github.com/nodemailer/nodemailer) with SMTP, MailGun or SendGrid
@@ -40,7 +40,7 @@ Inspired by [dstroot/skeleton](https://github.com/dstroot/skeleton) and [sahat/h
4040
* [x] **[socket.io](https://github.com/socketio/socket.io) connection with namespaces & authorization**
4141
* [x] [vue-websocket](https://github.com/icebob/vue-websocket)
4242
* [x] [Jade](https://github.com/pugjs/pug)
43-
* [x] **[Webpack 2](https://github.com/webpack/webpack)**
43+
* [x] **[Webpack 4](https://github.com/webpack/webpack)**
4444
* [x] [SCSS](http://sass-lang.com/)
4545
* [x] [PostCSS](https://github.com/postcss/postcss) with precss and autoprefixer
4646
* [x] [Babel](https://babeljs.io/)

‎build/webpack.prod.config.js‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ module.exports = merge(baseWpConfig, {
1818
use: [
1919
MiniCssExtractPlugin.loader,
2020
{
21-
loader: "css-loader",
21+
loader: "css-loader"/*,
2222
options: {
2323
modules: true,
2424
sourceMap: true,
2525
importLoader: 2
26-
}
26+
}*/
2727
},
2828
"sass-loader"
2929
]
@@ -35,12 +35,12 @@ module.exports = merge(baseWpConfig, {
3535
sass: [
3636
MiniCssExtractPlugin.loader,
3737
{
38-
loader: "css-loader",
38+
loader: "css-loader"/*,
3939
options: {
4040
modules: true,
4141
sourceMap: true,
4242
importLoader: 2
43-
}
43+
}*/
4444
},
4545
"sass-loader"
4646
]
@@ -56,7 +56,6 @@ module.exports = merge(baseWpConfig, {
5656
splitChunks: {
5757
cacheGroups: {
5858
vendor: {
59-
chunks: "initial",
6059
test: "vendor",
6160
name: "vendor",
6261
enforce: true
@@ -79,7 +78,9 @@ module.exports = merge(baseWpConfig, {
7978
minimize: true
8079
}),
8180

82-
new MiniCssExtractPlugin("styles/[name].css")
81+
new MiniCssExtractPlugin({
82+
filename: "styles/[name].css"
83+
})
8384

8485
/*new StatsPlugin(path.resolve(__dirname, "stats.json"), {
8586
chunkModules: true

‎client/scss/frontend.scss‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ body {
3838
top: 0; bottom: 0;
3939

4040
display: block;
41-
background: black url('../images/frontend-background.jpg');
41+
background: black url('~images/frontend-background.jpg');
4242
width: 100%;
4343
height: 100%;
4444
background-size: cover;
@@ -96,7 +96,7 @@ body {
9696
box-shadow: 0 0 10px rgba(0,0,0,1);
9797

9898
.bg {
99-
background-image: url('../images/frontend-background.jpg');
99+
background-image: url('~images/frontend-background.jpg');
100100
background-size: cover;
101101
background-position: center center;
102102
position: absolute;

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"method-override": "3.0.0",
8282
"mkdirp": "0.5.1",
8383
"moment": "2.22.2",
84-
"mongoose": "5.2.10",
84+
"mongoose": "5.2.12",
8585
"mongoose-auto-increment": "5.0.1",
8686
"morgan": "1.9.0",
8787
"netjet": "1.3.0",

‎server/applogic/modules/devices/models/device.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let config = require("../../../../config");
55
let logger = require("../../../../core/logger");
66

77
let db = require("../../../../core/mongo");
8-
let mongoose = require("mongoose");
8+
let mongoose = require("../../../../core/mongoose");
99
let Schema = mongoose.Schema;
1010
let hashids = require("../../../../libs/hashids")("devices");
1111
let autoIncrement = require("mongoose-auto-increment");
@@ -43,7 +43,7 @@ let DeviceSchema = new Schema({
4343
"default": 1
4444
},
4545
lastCommunication: {
46-
type: Date,
46+
type: Date,
4747
"default": Date.now
4848
},
4949
metadata: {}

‎server/applogic/modules/posts/models/post.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let logger = require("../../../../core/logger");
77
let _ = require("lodash");
88

99
let db = require("../../../../core/mongo");
10-
let mongoose = require("mongoose");
10+
let mongoose = require("../../../../core/mongoose");
1111
let Schema = mongoose.Schema;
1212
let hashids = require("../../../../libs/hashids")("posts");
1313
let autoIncrement = require("mongoose-auto-increment");

‎server/config/config.template.js‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let path = require("path");
44
let pkg = require("./package.json");
55

66
module.exports = {
7-
7+
88
// Secret for ID hashing
99
hashSecret: "{{hashSecret}}",
1010

@@ -33,7 +33,8 @@ module.exports = {
3333
// uri: process.env.MONGO_URI || "mongodb://localhost/vemapp",
3434
options: {
3535
user: process.env.MONGO_USERNAME || "",
36-
pass: process.env.MONGO_PASSWORD || ""
36+
pass: process.env.MONGO_PASSWORD || "",
37+
useNewUrlParser: true
3738
}
3839
},
3940

@@ -42,7 +43,7 @@ module.exports = {
4243
enabled: false,
4344
uri: process.env.REDIS_URI || "redis://localhost:6379",
4445
options: null
45-
},
46+
},
4647

4748
// Mail sending settings
4849
mailer: {
@@ -88,7 +89,7 @@ module.exports = {
8889
features: {
8990
disableSignUp: false,
9091
verificationRequired: true
91-
},
92+
},
9293

9394
// Social authentication (OAuth) keys
9495
authKeys: {
@@ -111,12 +112,12 @@ module.exports = {
111112
twitter: {
112113
clientID: null,
113114
clientSecret: null
114-
}
115+
}
115116
},
116117

117118
// Logging settings
118119
logging: {
119-
120+
120121
console: {
121122
// level: "debug"
122123
},
@@ -152,17 +153,17 @@ module.exports = {
152153
token: null,
153154
subdomain: null
154155
},
155-
156+
156157
logsene: {
157158
enabled: false,
158159
token: null
159160
},
160-
161+
161162
logzio: {
162163
enabled: false,
163164
token: null
164165
}
165-
166+
166167
}
167168

168169
};

‎server/core/express.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let compress = require("compression");
2323
let methodOverride = require("method-override");
2424
let helmet = require("helmet");
2525
let crossdomain = require("helmet-crossdomain");
26-
let mongoose = require("mongoose");
26+
let mongoose = require("../core/mongoose");
2727
let MongoStore = require("connect-mongo")(session);
2828

2929
let i18next = require("i18next");

‎server/core/mongo.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let logger = require("./logger");
44
let config = require("../config");
55

66
let chalk = require("chalk");
7-
let mongoose = require("mongoose");
7+
let mongoose = require("../core/mongoose");
88
let autoIncrement = require("mongoose-auto-increment");
99

1010
module.exports = function() {
@@ -16,7 +16,7 @@ module.exports = function() {
1616

1717
if (mongoose.connection.readyState !== 1) {
1818
logger.info("Connecting to Mongo " + config.db.uri + "...");
19-
db = mongoose.createConnection(config.db.uri, config.db.options, function mongoAfterConnect(err) {
19+
db = mongoose.connect(config.db.uri, config.db.options, function mongoAfterConnect(err) {
2020
if (err) {
2121
logger.error("Could not connect to MongoDB!");
2222
return logger.error(err);
@@ -43,7 +43,7 @@ module.exports = function() {
4343
https://github.com/icebob/mongoose-autoincrement
4444
4545
*/
46-
autoIncrement.initialize(db);
46+
autoIncrement.initialize(mongoose.connection);
4747

4848
mongoose.connection.once("open", function mongoAfterOpen() {
4949
logger.info(chalk.yellow.bold("Mongo DB connected."));
@@ -63,11 +63,10 @@ module.exports = function() {
6363
}
6464
});
6565

66-
6766
} else {
6867
logger.info("Mongo already connected.");
6968
db = mongoose;
7069
}
7170

72-
return db;
71+
return mongoose.connection;
7372
};

‎server/core/mongoose.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const mongoose = require('mongoose');
2+
mongoose.set('useCreateIndex', true);
3+
//mongoose.set('useFindAndModify', false);
4+
module.exports = mongoose;
5+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /