diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index 7e9dc42..d1ae95b 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index f524616..26c14fd 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,8 @@ + + diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 0000000..9338ba6 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index a20247a..1b64e71 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,14 @@ + + + + - + - + @@ -29,8 +33,18 @@ - - + + + + + + + + + + + + @@ -46,54 +60,51 @@ - - + + - - + + - - + + - - + + - - - - - - - - - + + + + + + - - + + - - + + - - + + - - + + @@ -102,8 +113,18 @@ - - + + + + + + + + + + + + @@ -119,6 +140,9 @@ @@ -133,7 +157,7 @@ @@ -160,6 +184,8 @@ + + @@ -178,20 +204,6 @@ - - - - - - - - - @@ -230,7 +242,7 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + project + + + true + + bdd + + DIRECTORY + + false + + + + + @@ -276,18 +343,23 @@ - - + - + @@ -306,6 +378,14 @@ + + + + @@ -322,6 +402,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -330,6 +440,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -339,6 +487,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -354,6 +612,7 @@ + @@ -362,21 +621,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8ab17f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:argon + +# Create app directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Install app dependencies +COPY package.json /usr/src/app/ +RUN npm install + +# Bundle app source +COPY . /usr/src/app + +EXPOSE 8080 +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/app.js b/app.js index df77313..f84ff5d 100644 --- a/app.js +++ b/app.js @@ -11,6 +11,21 @@ var app = express(); app.use(helmet()); +app.use(function (req, res, next) { + + // Website you wish to allow to connect + res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080'); + // Request methods you wish to allow + res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); + // Request headers you wish to allow + res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); + // Set to true if you need the website to include cookies in the requests sent + // to the API (e.g. in case you use sessions) + res.setHeader('Access-Control-Allow-Credentials', true); + // Pass to next layer of middleware + next(); +}); + // view engine setup app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); diff --git a/helpers/moviedb-helper.js b/helpers/moviedb-helper.js index 3bbd4a0..69c8455 100644 --- a/helpers/moviedb-helper.js +++ b/helpers/moviedb-helper.js @@ -1,5 +1,5 @@ 'use strict'; -const tmdb = require('moviedb')(''), +const tmdb = require('moviedb')(''), log = require('../logger'); function getMoviesFromSearch(movieName, req) { diff --git a/routes/index.js b/routes/index.js index 46fb853..d26574c 100644 --- a/routes/index.js +++ b/routes/index.js @@ -81,6 +81,8 @@ router }); }) .get('/latestmovies', function(req, res) { + res.header("Content-Type", "application/json"); + movieDbService.getLatestMovies(req) .then(movie => { res.json(movie);