Skip to content

Commit 0994af7

Browse files
committed
unextract express-mvc-platform package dependencies in package.json
1 parent 6494f60 commit 0994af7

File tree

8 files changed

+1752
-1979
lines changed

8 files changed

+1752
-1979
lines changed

app/controllers/UserController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ module.exports = {
8181

8282
var id = req.param("id");
8383

84+
console.log(req.user);
85+
8486
User.findById(id, function (error, user) {
8587

8688
if (error) return res.serverError(error);

app/middlewares/TokenAuth.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var passport = require("passport");
22

33
module.exports = function (req, res, next) {
44

5+
console.log(req);
6+
57
passport.authenticate('jwt', function (error, user) {
68

79
if (error) return next(error);

app/models/User.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var mongoose = require("mongoose");
22
var bcrypt = require("bcrypt");
33

44
var schema = mongoose.Schema({
5+
56
username: {
67
type: String,
78
unique: true
@@ -26,14 +27,6 @@ var schema = mongoose.Schema({
2627
lang: {
2728
type: String,
2829
default: 'en'
29-
},
30-
created_at: {
31-
type: Date,
32-
default: Date.now
33-
},
34-
updated_at: {
35-
type: Date,
36-
default: Date.now
3730
}
3831

3932
}, {

app/routes/api.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
var router = require("express").Router();
22

33
router.post("/token", AuthController.token);
4-
router.get("/user", UserController.find);
5-
router.get("/user/:id", UserController.findOne);
6-
router.post("/user", UserController.create);
7-
router.put("/user/:id", UserController.update);
8-
router.delete("/user/:id", UserController.destroy);
4+
router.get("/user", TokenAuth, UserController.find);
5+
router.get("/user/:id", TokenAuth, UserController.findOne);
6+
router.post("/user", TokenAuth, UserController.create);
7+
router.put("/user/:id", TokenAuth, UserController.update);
8+
router.delete("/user/:id", TokenAuth, UserController.destroy);
99

1010
module.exports = router;

config/body.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
* if it is a string, the value is passed to the bytes library for parsing. Defaults to '100kb'.
2121
*/
2222

23-
limit: '100kb',
23+
limit: '20480kb',
2424

2525
/**
2626
* The parameterLimit option controls the maximum number of parameters that are allowed in the URL-encoded data.

config/env/local.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
3+
db: {
4+
url: 'mongodb://localhost/express'
5+
}
6+
7+
}

0 commit comments

Comments
 (0)