Skip to content

Commit

Permalink
Added Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeieshan Ahmed committed May 6, 2016
1 parent c3a8505 commit c6cb457
Show file tree
Hide file tree
Showing 8 changed files with 480 additions and 62 deletions.
1 change: 1 addition & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

500 changes: 439 additions & 61 deletions .idea/workspace.xml

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
15 changes: 15 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion helpers/moviedb-helper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const tmdb = require('moviedb')('<API KEY>'),
const tmdb = require('moviedb')(''),
log = require('../logger');

function getMoviesFromSearch(movieName, req) {
Expand Down
2 changes: 2 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ router
});
})
.get('/latestmovies', function(req, res) {
res.header("Content-Type", "application/json");

movieDbService.getLatestMovies(req)
.then(movie => {
res.json(movie);
Expand Down

0 comments on commit c6cb457

Please sign in to comment.