-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
2120674
commit 7d8adfe
Showing
32 changed files
with
668 additions
and
1 deletion.
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,7 +1,33 @@ | ||
var express = require('express'); | ||
var app = express(); | ||
|
||
app.use(express.static('static')); | ||
//app.use(express.static('static')); | ||
|
||
/** | ||
* Create .error and .tpl on res | ||
*/ | ||
app.use(function(req, res, next){ | ||
res.error = []; | ||
res.tpl = {}; | ||
return next(); | ||
}); | ||
|
||
/** | ||
* Include all route | ||
*/ | ||
require('./routes/apps')(app); | ||
require('./routes/judges')(app); | ||
require('./routes/news')(app); | ||
require('./routes/user')(app); | ||
|
||
/** | ||
* Error handler | ||
*/ | ||
app.use(function(err, req, res, next){ | ||
res.status(500).send("Error"); // sends a http err msg | ||
console.error(err.stack); // write the err to std:err | ||
}); | ||
|
||
var server = app.listen(3000, function () { | ||
console.log("On :3000") | ||
}); |
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 @@ | ||
/** | ||
* Deletes the app, than redirects to the apps page (/apps) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Lists all the applications that are currently active | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Gets the app with the given id | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Lists all the applications | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates/Updates the app, than redirects to the apps page (/apps) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Deletes the score, than redirects to the app's page (/apps/app/:id) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates/Updates the score, than redirects to the app's page (/apps/app/:id) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Checks the user's permission and store it for other middlewares | ||
* if access denied for this page, redirects to the root page (/) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates the html page from templates and given parameters for the response | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Deletes the news with the given id | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Lists and store the list of the news' | ||
*/ | ||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates / updates the news with the given id with the given datas | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Changes the user's permission to admin or to normal user | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* From a list of users, the function deletes all user with only normal permission | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Lists all the portal's users | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* The function completes a user list with the permissions of the users in it. | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Deletes the application recieved from the user for the given app id | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Lists and stores the applications received from the user | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates / updates the application received from the user for the given app id | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates a new password | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Lists the user whose email has been given | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates / updates the user profile | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Updates the user's password | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Logging in | ||
* in case of any problem, log out the user and redirects to the root page (/) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Logging out | ||
* in case of any problem, the log out is failed and redirects to the root page (/) | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Sends an email for the user with the given text | ||
*/ | ||
|
||
module.exports = function () { | ||
|
||
return function (req, res, next) { | ||
return next(); | ||
}; | ||
|
||
}; |
Oops, something went wrong.