File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,20 @@ module.exports = {
37
37
} )
38
38
} ,
39
39
40
+ moviesById ( req , res ) {
41
+ var moviesId = req . params . id ;
42
+ if ( ! mongoose . Types . ObjectId . isValid ( moviesId ) ) {
43
+ return res . status ( 400 ) . send ( "The provided movies id is invalid!" ) ;
44
+ }
45
+ Movies . findById ( moviesId , function ( err , movies ) {
46
+ if ( err ) {
47
+ res . sendStatus ( 500 ) ;
48
+ } else {
49
+ res . send ( movies ) ;
50
+ }
51
+ } )
52
+ } ,
53
+
40
54
episodes ( req , res ) {
41
55
var seriesId = req . params . id ;
42
56
if ( ! mongoose . Types . ObjectId . isValid ( seriesId ) ) {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ function initRoutes(app) {
14
14
app . get ( '/series/:id/episodes' , SeriesMovieController . episodes ) ;
15
15
app . get ( '/series/:id/episodes/:eid' , SeriesMovieController . episodesByEid ) ;
16
16
app . get ( '/movies' , SeriesMovieController . movies ) ;
17
+ app . get ( '/movies/:id' , SeriesMovieController . moviesById ) ;
17
18
}
18
19
19
20
module . exports = initRoutes ;
You can’t perform that action at this time.
0 commit comments