-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathreddit.js
45 lines (39 loc) · 1.49 KB
/
reddit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var request = require('request');
/*
This function should "return" the default homepage posts as an array of objects
*/
function getHomepage(callback) {
// Load reddit.com/.json and call back with the array of posts
}
/*
This function should "return" the default homepage posts as an array of objects.
In contrast to the `getHomepage` function, this one accepts a `sortingMethod` parameter.
*/
function getSortedHomepage(sortingMethod, callback) {
// Load reddit.com/{sortingMethod}.json and call back with the array of posts
// Check if the sorting method is valid based on the various Reddit sorting methods
}
/*
This function should "return" the posts on the front page of a subreddit as an array of objects.
*/
function getSubreddit(subreddit, callback) {
// Load reddit.com/r/{subreddit}.json and call back with the array of posts
}
/*
This function should "return" the posts on the front page of a subreddit as an array of objects.
In contrast to the `getSubreddit` function, this one accepts a `sortingMethod` parameter.
*/
function getSortedSubreddit(subreddit, sortingMethod, callback) {
// Load reddit.com/r/{subreddit}/{sortingMethod}.json and call back with the array of posts
// Check if the sorting method is valid based on the various Reddit sorting methods
}
/*
This function should "return" all the popular subreddits
*/
function getSubreddits(callback) {
// Load reddit.com/subreddits.json and call back with an array of subreddits
}
// Export the API
module.exports = {
// ...
};