diff --git a/README.md b/README.md index 61e5683..58fb35c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,4 @@ Changing lives, one podcast at a time. 5. *optional* ```createdb sharecast_test``` 6. ```knex migrate:latest``` 7. ```knex seed:run``` -8. Review apiDoc documentation: - * Navigate to the root folder of ShareCast - * ```cd apidoc/``` - * ```open index.html``` to open apiDoc in browser +8. Review apiDoc documentation:http://sharecast-g52.surge.sh/ diff --git a/index.js b/index.js index 5189f33..b0ae242 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,8 @@ 'use strict'; -require('dotenv').config(); + +if (process.env.NODE_ENV !== 'production') { + require('dotenv').config(); +} const helmet = require('helmet'); const express = require('express'); diff --git a/knexfile.js b/knexfile.js index db5d53c..595416f 100644 --- a/knexfile.js +++ b/knexfile.js @@ -15,5 +15,13 @@ module.exports = { seeds: { directory: `${__dirname}/seeds/development` } + }, + + production: { + client: 'pg', + connection: process.env.DATABASE_URL, + seeds: { + directory: `${__dirname}/seeds/development` + } } }; diff --git a/package.json b/package.json index 89e0af6..4ea56e9 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,11 @@ "test": "test" }, "scripts": { + "heroku-postbuild": "knex migrate:latest", "knex": "knex", "test": "mocha", - "testnyc": "nyc mocha" + "testnyc": "nyc mocha", + "start": "node index.js" }, "repository": { "type": "git", diff --git a/routes/favorites.js b/routes/favorites.js index 205c58d..fa9a168 100644 --- a/routes/favorites.js +++ b/routes/favorites.js @@ -39,7 +39,7 @@ const router = express.Router(); * @apiSuccess {Number} searchResults.podcastId Podcast ID. * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK - * { + * [{ id: 1, artistId: 1134742667, collectionId: 948976028, @@ -81,7 +81,7 @@ const router = express.Router(); userId: 1, userIdShared: 2, podcastId: 2 - } + }] * * @apiErrorExample {json} Unauthorized user * HTTP/1.1 401 "Unauthorized" @@ -138,7 +138,7 @@ router.get('/', checkForToken, verifyUser, (req, res, next) => { * @apiSuccess {String[]} searchResults.genres Genres for the podcast. * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK - * { + * [{ id: 1, userId: 1, userIdShared: 2, @@ -159,7 +159,7 @@ router.get('/', checkForToken, verifyUser, (req, res, next) => { artworkUrl600: 'http://is1.mzstatic.com/image/thumb/Music62/v4/ce/22/03/ce220318-10da-b927-16fb-ab5479045e1b/source/600x600bb.jpg', genreIds: [ '1305', '26', '1301', '1304' ], genres: [ 'Kids & Family', 'Podcasts', 'Arts', 'Education' ] - } + }] * * @apiErrorExample {json} Unauthorized user * HTTP/1.1 401 "Unauthorized" diff --git a/routes/login.js b/routes/login.js index 6f10c56..6fb1c20 100644 --- a/routes/login.js +++ b/routes/login.js @@ -88,20 +88,6 @@ router.post('/' , verifyLoginDetails, (req, res, next) => { }); - -// route.get('/', verifyLoginDetails, (req, res, next) => { -// // NOTE should GET requests even hit this route? -// -// //if so then we'll just want to pass them either to their auth landing page or?? -// }) - - //this route is for new users only - - -// function checkIfUserIsRegistered(req, res, next) { -// -// } - function verifyLoginDetails(req, res, next) { let email = req.body.email; @@ -123,6 +109,4 @@ function verifyLoginDetails(req, res, next) { } }; - - module.exports = router; diff --git a/routes/search.js b/routes/search.js index 4b1793e..ec453a0 100644 --- a/routes/search.js +++ b/routes/search.js @@ -42,7 +42,7 @@ const ITUNES_PODCAST_LOOKUP_BASE_URL = "https://itunes.apple.com/lookup?id=" * @apiSuccess {String} searchResults.trackViewUrl URL for podcast on iTunes. * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK - * { + * [{ "artistName": "Maria Calanchini", "artworkUrl60": "http://is1.mzstatic.com/image/thumb/Music62/v4/9e/d5/9d/9ed59d33-a591-26cd-d740-e8f906a08a15/source/60x60bb.jpg", "artworkUrl600": "http://is1.mzstatic.com/image/thumb/Music62/v4/9e/d5/9d/9ed59d33-a591-26cd-d740-e8f906a08a15/source/600x600bb.jpg", @@ -132,7 +132,7 @@ const ITUNES_PODCAST_LOOKUP_BASE_URL = "https://itunes.apple.com/lookup?id=" ], "trackId": 733259146, "trackViewUrl": "https://itunes.apple.com/us/podcast/goop-directory-the-by-burgess-frank-gelett/id733259146?mt=2&uo=4" - } + }] * * @apiErrorExample {json} List error * HTTP/1.1 500 Internal Server Error diff --git a/routes/shared.js b/routes/shared.js deleted file mode 100644 index e69de29..0000000