@@ -58,14 +58,16 @@ enum Errors {
58
58
CREATOR_FETCH_FAILED = 'CREATOR_FETCH_FAILED' ,
59
59
SEARCH_FETCH_FAILED = 'SEARCH_FETCH_FAILED' ,
60
60
USER_RATINGS_FETCH_FAILED = 'USER_RATINGS_FETCH_FAILED' ,
61
- PAGE_NOT_FOUND = 'PAGE_NOT_FOUND'
61
+ CINEMAS_FETCH_FAILED = 'CINEMAS_FETCH_FAILED' ,
62
+ PAGE_NOT_FOUND = 'PAGE_NOT_FOUND' ,
62
63
}
63
64
64
65
enum Endpoint {
65
66
MOVIE = '/movie/:id' ,
66
67
CREATOR = '/creator/:id' ,
67
68
SEARCH = '/search/:query' ,
68
- USER_RATINGS = '/user-ratings/:id'
69
+ USER_RATINGS = '/user-ratings/:id' ,
70
+ CINEMAS = '/cinemas'
69
71
}
70
72
71
73
type ErrorLog = {
@@ -170,6 +172,19 @@ app.get(Endpoint.USER_RATINGS, async (req, res) => {
170
172
}
171
173
} ) ;
172
174
175
+
176
+ app . get ( Endpoint . CINEMAS , async ( req , res ) => {
177
+ try {
178
+ const result = await csfd . cinema ( 1 , 'today' ) ;
179
+ logMessage ( 'success' , { error : null , message : `${ Endpoint . CINEMAS } ` } , req ) ;
180
+ res . json ( result ) ;
181
+ } catch ( error ) {
182
+ const log : ErrorLog = { error : Errors . CINEMAS_FETCH_FAILED , message : 'Failed to fetch cinemas data: ' + error }
183
+ logMessage ( 'error' , log , req ) ;
184
+ res . status ( 500 ) . json ( log ) ;
185
+ }
186
+ } ) ;
187
+
173
188
app . use ( ( req , res ) => {
174
189
const log : ErrorLog = { error : Errors . PAGE_NOT_FOUND , message : 'The requested endpoint could not be found.' } ;
175
190
logMessage ( 'warn' , log , req ) ;
0 commit comments