Skip to content

Commit

Permalink
Added CORS support
Browse files Browse the repository at this point in the history
  • Loading branch information
crock committed Oct 12, 2018
1 parent 70cd99a commit 7b4963a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MYSQL_HOST=localhost
MYSQL_DBNAME=ogcheckr
MYSQL_USER=root
MYSQL_PASS=

TWTR_CONSUMER_KEY=5U0ev9qJsvftnfwiSCTyutkdX
TWTR_CONSUMER_SECRET=mB9CqIzHUM3txexs0K7cPwG6rjv6KJJGuyBqvnMP1YQMH2FMnj
TWTR_ACCESS_TOKEN=1605581-z9Yj5FUNSUJ4rLYAg6hSVpRrYw0PVCEXp9ltaDqi71
TWTR_ACCESS_TOKEN_SECRET=JlBfbMWfHTgcKvl2fPihuG6mW3GXEs2W72L374JHH80mL

TWITCH_CLIENT_ID=w7lfhv6pmv84fn4206xe6fnwrfidaq
TWITCH_CLIENT_SECRET=cirn6e30vu0puqk3kbjs52u8a3islk

IG_CLIENT_KEY=3901f8d2483c4f4b969e84ad07ef092a
IG_CLIENT_SECRET=d729e218a5b84b7d94bb5b755910bc17
IG_ACCESS_TOKEN=1639482.3901f8d.3f5a8cacf40a4a959aebc8b0149cf78d
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ configs/instagram.json
configs/twitch.json

# Private API Keys
apikeys.json
apikeys.json

# temp files
tmp/
10 changes: 2 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const express = require('express');
const cors = require('cors');
const app = express();
const router = express.Router();

Expand All @@ -16,14 +17,7 @@ const CheckSteam = require('./libs/Steam');
const CheckYoutube = require('./libs/Youtube');
const CheckMixer = require('./libs/Mixer');

var options = {
setHeaders: function (res, path, stat) {
res.set('Access-Control-Allow-Origin', '*')
}
}

app.use(express.static('public', options))

app.use(cors())
app.use(router);
app.use(timeout('5s'));
app.use(bodyParser.json());
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ogcheckr-api",
"name": "penguin-api",
"version": "0.0.0",
"private": true,
"scripts": {
Expand All @@ -12,6 +12,7 @@
"cheerio": "^1.0.0-rc.2",
"connect-timeout": "^1.9.0",
"cookie-parser": "~1.4.3",
"cors": "^2.8.4",
"debug": "~2.6.9",
"express": "~4.15.5",
"faker": "^4.1.0",
Expand Down
11 changes: 9 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

cors@^2.8.4:
version "2.8.4"
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.4.tgz#2bd381f2eb201020105cd50ea59da63090694686"
dependencies:
object-assign "^4"
vary "^1"

cross-fetch@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-1.1.1.tgz#dede6865ae30f37eae62ac90ebb7bdac002b05a0"
Expand Down Expand Up @@ -1188,7 +1195,7 @@ oauth-sign@~0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"

object-assign@^4.0.1, object-assign@^4.1.0:
object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

Expand Down Expand Up @@ -1831,7 +1838,7 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"

vary@~1.1.1:
vary@^1, vary@~1.1.1:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

Expand Down

0 comments on commit 7b4963a

Please sign in to comment.