Skip to content

Commit

Permalink
Services Route update
Browse files Browse the repository at this point in the history
Added a new route to request more details regarding all the supported
services.
  • Loading branch information
crock committed Aug 21, 2018
1 parent 94db9a1 commit c5a0650
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 10 deletions.
13 changes: 11 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,17 @@ router.get('/', function(req, res) {
});

router.get('/check/services', function(req, res) {
var services = require('./services.json');
res.json(services);
var simple = {};
var advanced = require('./services.json');
for (var key in advanced.services) {
simple.services.push(advanced.services[key].slug)
}
res.json(simple);
});

router.get('/check/services/details', function(req, res) {
var obj = require('./services.json');
res.json(obj);
});

router.get('/check/:service/:word', [cacheWithRedis('6 hours')], function(req, res) {
Expand Down
119 changes: 111 additions & 8 deletions services.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,113 @@
{
"services": [
"twitter",
"instagram",
"steamid",
"steamgroup",
"mixer",
"youtube"
]
"services": [
{
"name": "Twitter",
"slug": "twitter",
"endpoints": {
"baseUrl": "https://www.twitter.com",
"profileUrl": "https://twitter.com/%name%",
"requestUrl": "https://api.twitter.com/i/users/username_available.json?username=%name%"
},
"httpMethod": "GET",
"usernameCriteria": {
"minLength": 5,
"maxLength": 15,
"allowedUsernamePattern": "([a-zA-Z0-9_]+)",
"prohibitedWords": [
"twitter",
"admin"
]
}
},
{
"name": "Instagram",
"slug": "instagram",
"endpoints": {
"baseUrl": "https://www.instagram.com",
"profileUrl": "https://instagram.com/%name%",
"requestUrl": "https://instagram.com/accounts/web_create_ajax/attempt/"
},
"httpMethod": "POST",
"usernameCriteria": {
"minLength": 1,
"maxLength": 30,
"allowedUsernamePattern": "([a-zA-Z0-9_\\.]+)",
"prohibitedWords": []
}
},
{
"name": "Steam ID",
"slug": "steamid",
"endpoints": {
"baseUrl": "https://www.steamcommunity.com",
"profileUrl": "https://steamcommunity.com/id/%name%",
"requestUrl": "https://steamcommunity.com/id/%name%"
},
"httpMethod": "GET",
"usernameCriteria": {
"minLength": 1,
"maxLength": 31,
"allowedUsernamePattern": "([a-zA-Z0-9_]+)",
"prohibitedWords": [
"valve",
"support"
]
}
},
{
"name": "Steam Group",
"slug": "steamgroup",
"endpoints": {
"baseUrl": "https://www.steamcommunity.com",
"profileUrl": "https://steamcommunity.com/groups/%name%",
"requestUrl": "https://steamcommunity.com/groups/%name%"
},
"httpMethod": "GET",
"usernameCriteria": {
"minLength": 1,
"maxLength": 31,
"allowedUsernamePattern": "([a-zA-Z0-9_]+)",
"prohibitedWords": [
"valve",
"support"
]
}
},
{
"name": "Mixer",
"slug": "mixer",
"endpoints": {
"baseUrl": "https://www.mixer.com",
"profileUrl": "https://mixer.com/api/v1/channels/%name%",
"requestUrl": "https://mixer.com/api/v1/channels/%name%"
},
"httpMethod": "GET",
"usernameCriteria": {
"minLength": 1,
"maxLength": 31,
"allowedUsernamePattern": "([a-zA-Z0-9]+)",
"prohibitedWords": []
}
},
{
"name": "YouTube",
"slug": "youtube",
"endpoints": {
"baseUrl": "https://www.youtube.com/",
"profileUrl": "https://www.youtube.com/user/%name%",
"requestUrl": "https://www.youtube.com/c/%name%"
},
"httpMethod": "GET",
"usernameCriteria": {
"minLength": 4,
"maxLength": 20,
"allowedUsernamePattern": "([a-zA-Z0-9]+)",
"prohibitedWords": [
"youtube",
"google",
"admin"
]
}
}
]
}

0 comments on commit c5a0650

Please sign in to comment.