-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add torrents module server side code
test get movie info from TMDB
- Loading branch information
1 parent
683dd84
commit ffff1df
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies | ||
*/ | ||
var path = require('path'), | ||
config = require(path.resolve('./config/config')); | ||
|
||
/** | ||
* Module init function. | ||
*/ | ||
module.exports = function (app, db) { | ||
|
||
}; |
25 changes: 25 additions & 0 deletions
25
modules/torrents/server/controllers/torrents.server.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies | ||
*/ | ||
var path = require('path'), | ||
mongoose = require('mongoose'), | ||
errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')), | ||
tmdb = require('moviedb')('7888f0042a366f63289ff571b68b7ce0'); | ||
|
||
/** | ||
* Create an article | ||
*/ | ||
exports.movieinfo = function (req, res) { | ||
console.log('------- API: movieinfo --------------------'); | ||
|
||
tmdb.movieInfo({id: 263115, language: 'zh'}, function (err, info) { | ||
if (err) { | ||
console.log(err); | ||
} else { | ||
res.json(info); | ||
} | ||
}); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies | ||
*/ | ||
var torrents = require('../controllers/torrents.server.controller'); | ||
|
||
module.exports = function (app) { | ||
// Articles collection routes | ||
app.route('/api/movieinfo') | ||
.get(torrents.movieinfo); | ||
|
||
}; |