This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nikhiljohn10/master
1.0.0 - First version complete
- Loading branch information
Showing
11 changed files
with
286 additions
and
87 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
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,40 @@ | ||
/** | ||
* MainController | ||
* | ||
* @description :: Server-side logic for managing Mains | ||
* @help :: See http://links.sailsjs.org/docs/controllers | ||
*/ | ||
|
||
module.exports = { | ||
|
||
index: function(req, res) { | ||
var options = { | ||
region: "Kerala", | ||
limit: 7, | ||
start_date: (new Date()).toISOString() | ||
}; | ||
getEvents(options, function(err, data) { | ||
return res.view("homepage", { | ||
events: data | ||
}); | ||
}); | ||
} | ||
}; | ||
|
||
function getEvents(opt, callback) { | ||
var request = require("request"); | ||
var url = "https://reps.mozilla.org/api/v1/event/?"; | ||
if (opt.region) | ||
url += "®ion=" + opt.region; | ||
if (opt.limit) | ||
url += "&limit=" + opt.limit; | ||
if (opt.start_date) | ||
url += "&start__gte=" + opt.start_date; | ||
request(url, function(error, response, data) { | ||
if (!error) { | ||
callback(error, JSON.parse(data)); | ||
} else { | ||
console.log(error); | ||
} | ||
}); | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.