This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
226 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{ | ||
"directory": "public/lib" | ||
"directory": "public/lib", | ||
"storage": { | ||
"packages": ".bower-cache", | ||
"registry": ".bower-registry" | ||
}, | ||
"tmp": ".bower-tmp" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
// Articles routes use articles controller | ||
var articles = require('../controllers/articles'); | ||
var authorization = require('./middlewares/authorization'); | ||
|
||
// Article authorization helpers | ||
var hasAuthorization = function(req, res, next) { | ||
if (req.article.user.id !== req.user.id) { | ||
return res.send(401, 'User is not authorized'); | ||
} | ||
next(); | ||
}; | ||
|
||
module.exports = function(app) { | ||
|
||
app.get('/articles', articles.all); | ||
app.post('/articles', authorization.requiresLogin, articles.create); | ||
app.get('/articles/:articleId', articles.show); | ||
app.put('/articles/:articleId', authorization.requiresLogin, hasAuthorization, articles.update); | ||
app.del('/articles/:articleId', authorization.requiresLogin, hasAuthorization, articles.destroy); | ||
|
||
// Finish with setting up the articleId param | ||
app.param('articleId', articles.article); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = function(app) { | ||
|
||
// Home route | ||
var index = require('../controllers/index'); | ||
app.get('/', index.render); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Generic require login routing middleware | ||
*/ | ||
exports.requiresLogin = function(req, res, next) { | ||
if (!req.isAuthenticated()) { | ||
return res.send(401, 'User is not authorized'); | ||
} | ||
next(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "mean", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"dependencies": { | ||
"angular": "latest", | ||
"angular": "1.2.10", | ||
"angular-resource": "latest", | ||
"angular-cookies": "latest", | ||
"angular-mocks": "latest", | ||
"angular-route": "latest", | ||
"bootstrap": "2.3.2", | ||
"angular-bootstrap": "0.7.0", | ||
"angular-ui-utils": "0.0.4" | ||
"bootstrap": "3.0.3", | ||
"angular-bootstrap": "0.10.0", | ||
"angular-ui-utils": "0.1.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.