Skip to content

Commit

Permalink
Prep for Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
crock committed Dec 8, 2018
1 parent b985e56 commit b3c4f03
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 99 deletions.
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Instagram
IG_CLIENT_ID=
IG_CLIENT_SECRET=
IG_ACCESS_TOKEN=

# Twitter
TWTR_CONSUMER_KEY=
TWTR_CONSUMER_SECRET=
TWTR_ACCESS_TOKEN_KEY=
TWTR_ACCESS_TOKEN_SECRET=

# TWitch
TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ node_modules/
.atom/

# Private Configuration Variables
configs/twitter.json
configs/instagram.json
configs/twitch.json
configs/*
.env

# Private API Keys
apikeys.json
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web=npm start
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# OGCheckr API
# Penguin API

The official REST API for OGCheckr applications
The official REST API for Penguin apps
4 changes: 3 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('dotenv').config();

const express = require('express');
const cors = require('cors');
const app = express();
Expand Down Expand Up @@ -109,6 +111,6 @@ function haltOnTimedout (req, res, next) {
if (!req.timedout) next()
}

app.listen(8080, 'localhost');
app.listen(process.env.PORT || 5000);

module.exports = app;
5 changes: 0 additions & 5 deletions configs/instagram.example.json

This file was deleted.

4 changes: 0 additions & 4 deletions configs/twitch.example.json

This file was deleted.

6 changes: 0 additions & 6 deletions configs/twitter.example.json

This file was deleted.

74 changes: 0 additions & 74 deletions docs.html

This file was deleted.

3 changes: 1 addition & 2 deletions libs/Twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const twitch = require('twitch-api-v5');

function CheckTwitch(service, word, res) {
res.type('json');
var config = require('../configs/twitch.json');

twitch.clientID = config.clientId;
twitch.clientID = process.env.TWITCH_CLIENT_ID;

twitch.users.usersByName({"users": [word]}, function(error, response) {
if(error) {
Expand Down
7 changes: 6 additions & 1 deletion libs/Twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ const Twitter = require('twitter-lite');

function CheckTwitter(service, word, res) {
res.type('json');
var config = require('../configs/twitter.json');
var config = {
"consumer_key": process.env.TWTR_CONSUMER_KEY,
"consumer_secret": process.env.TWTR_CONSUMER_SECRET,
"access_token_key": process.env.TWTR_ACCESS_TOKEN_KEY,
"access_token_secret": process.env.TWTR_ACCESS_TOKEN_SECRET
};
var client = new Twitter(config);

client.get('users/show', {screen_name: word, include_entities: false})
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
"dev": "node ./bin/www",
"start": "node ./app.js"
},
"dependencies": {
"apicache": "^1.2.1",
Expand All @@ -14,6 +15,7 @@
"cookie-parser": "~1.4.3",
"cors": "^2.8.4",
"debug": "~2.6.9",
"dotenv": "^6.2.0",
"express": "~4.15.5",
"faker": "^4.1.0",
"morgan": "~1.9.0",
Expand Down
Loading

0 comments on commit b3c4f03

Please sign in to comment.