Skip to content

Commit 39664db

Browse files
committed
update to pug, add docker, fix bugs
1 parent 0674cb5 commit 39664db

36 files changed

+7039
-219
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"presets": ["stage-0"]
2+
"presets": []
33
}

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SOME_ENV_ID=abc
1+
MONGODB_URL=mongodb://mongo:27017/my_app_dev

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.vscode
3+
.git
4+
public
5+
data

.eslintrc

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
{
2-
"extends": "eslint:recommended",
2+
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
33
"env": {
44
"browser": false,
55
"es6": true,
66
"node": true
77
},
88
"parser": "babel-eslint",
99
"rules": {
10-
"object-curly-spacing": [2, "always"],
11-
"strict": 0,
12-
"quotes": [2, "single", "avoid-escape"],
13-
"semi": [2, "always"],
14-
"space-before-function-paren": [2, "always"],
15-
"keyword-spacing": [2, {"before": true, "after": true}],
16-
"space-infix-ops": 2,
17-
"spaced-comment": [2, "always"],
18-
"arrow-spacing": 2,
19-
"no-console": 0
20-
},
21-
"globals": {
10+
"prettier/prettier": ["error", {
11+
"singleQuote": true
12+
}],
13+
"no-console": "off"
2214
}
2315
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22
npm-debug.log
33
.env
4+
data
5+
.vscode

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ services:
22
- mongodb
33
language: node_js
44
node_js:
5-
- "6.0.0"
6-
- "6.1.0"
5+
- "10.11.0"

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[![Build Status](https://img.shields.io/travis/madhums/node-express-mongoose.svg?style=flat)](https://travis-ci.org/madhums/node-express-mongoose)
22
[![Dependencies](https://img.shields.io/david/madhums/node-express-mongoose.svg?style=flat)](https://david-dm.org/madhums/node-express-mongoose)
3-
[![Code Climate](https://codeclimate.com/github/madhums/node-express-mongoose/badges/gpa.svg)](https://codeclimate.com/github/madhums/node-express-mongoose)
3+
[![Code Climate](https://codeclimate.com/github/codeclimate/codeclimate/badges/gpa.svg)](https://codeclimate.com/github/madhums/node-express-mongoose)
44
[![Greenkeeper badge](https://badges.greenkeeper.io/madhums/node-express-mongoose.svg)](https://greenkeeper.io/)
55
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/madhums/node-express-mongoose?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6-
[![Gittip](https://img.shields.io/gratipay/madhums.svg?style=flat)](https://www.gratipay.com/madhums/)
76

87
## Node Express Mongoose
98

@@ -21,6 +20,41 @@ Read the [wiki](https://github.com/madhums/node-express-mongoose/wiki) to unders
2120

2221
Checkout the [apps that are built using this approach](https://github.com/madhums/node-express-mongoose/wiki/Apps-built-using-this-approach)
2322

23+
## Docker
24+
25+
You can also use docker for development. Make sure you run npm install on your host machine so that code linting and everything works fine.
26+
27+
```sh
28+
$ npm i
29+
$ cp .env.example .env
30+
```
31+
32+
Start the services
33+
34+
```sh
35+
$ docker-compose up -d
36+
```
37+
38+
View the logs
39+
40+
```sh
41+
$ docker-compose logs -f
42+
```
43+
44+
In case you install a npm module while developing, it should also be installed within docker container, to do this first install the module you want with simple `npm i module name`, then run it within docker container
45+
46+
```sh
47+
$ docker-compose exec node npm i
48+
```
49+
50+
If you make any changes to the file, nodemon should automatically pick up and restart within docker (you can see this in the logs)
51+
52+
To run tests
53+
54+
```sh
55+
$ docker-compose exec node npm test
56+
```
57+
2458
## License
2559

2660
MIT

app/controllers/home.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
/*!
32
* Module dependencies.
43
*/
54

6-
exports.index = function (req, res) {
5+
exports.index = function(req, res) {
76
res.render('home/index', {
87
title: 'Node Express Mongoose Boilerplate'
98
});

app/models/user.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
21
/*!
32
* Module dependencies
43
*/
54

65
var mongoose = require('mongoose');
7-
var userPlugin = require('mongoose-user');
86
var Schema = mongoose.Schema;
97

108
/**
@@ -18,12 +16,6 @@ var UserSchema = new Schema({
1816
salt: { type: String, default: '' }
1917
});
2018

21-
/**
22-
* User plugin
23-
*/
24-
25-
UserSchema.plugin(userPlugin, {});
26-
2719
/**
2820
* Add your
2921
* - pre-save hooks
@@ -35,17 +27,13 @@ UserSchema.plugin(userPlugin, {});
3527
* Methods
3628
*/
3729

38-
UserSchema.method({
39-
40-
});
30+
UserSchema.method({});
4131

4232
/**
4333
* Statics
4434
*/
4535

46-
UserSchema.static({
47-
48-
});
36+
UserSchema.static({});
4937

5038
/**
5139
* Register
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extends layouts/default.jade
1+
extends layouts/default.pug
22

33
block main
44
h2 404 - Not found

0 commit comments

Comments
 (0)