File tree 3 files changed +19
-5
lines changed
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ const cors = require('cors')
6
6
7
7
const indexRouter = require ( './routes/index' ) ;
8
8
const usersRouter = require ( './routes/users' ) ;
9
- const postsRouter = require ( './routes/posts' )
10
- const productRouter = require ( './routes/products' )
9
+ const postsRouter = require ( './routes/posts' ) ;
10
+ const productRouter = require ( './routes/products' ) ;
11
+ const restaurantsRouter = require ( './routes/restaurants' ) ;
11
12
12
13
const app = express ( ) ;
13
14
@@ -22,5 +23,6 @@ app.use('/', indexRouter);
22
23
app . use ( '/users' , usersRouter ) ;
23
24
app . use ( '/posts' , postsRouter ) ;
24
25
app . use ( '/products' , productRouter )
26
+ app . use ( '/restaurants' , restaurantsRouter )
25
27
26
28
module . exports = app ;
Original file line number Diff line number Diff line change 9
9
},
10
10
"icon" : " https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png" ,
11
11
"id" : " 051d81107a55faa819fbfa41409d155a930fda40" ,
12
- "name " : " Pizza Inn" ,
12
+ "restaurant_name " : " Pizza Inn" ,
13
13
"place_id" : " ChIJ3Uuv9x8XLxgRQVM21qXjvZ0" ,
14
14
"price_level" : 2 ,
15
15
"average_rating" : 4.1 ,
37
37
},
38
38
"icon" : " https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png" ,
39
39
"id" : " 5a9a202fc80bb0cc995462b3c2d2b22093af73e9" ,
40
- "name " : " Creamy Inn-Parklands" ,
40
+ "restaurant_name " : " Creamy Inn-Parklands" ,
41
41
"place_id" : " ChIJYa5q9x8XLxgRCEp4BQSVVjA" ,
42
42
"average_rating" : 3.3 ,
43
43
"ratings" :[
64
64
},
65
65
"icon" : " https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png" ,
66
66
"id" : " 0e49e1f29b829a3e6c0e399cc4b6316c0715da9d" ,
67
- "name " : " My Shop-Parklands" ,
67
+ "restaurant_name " : " My Shop-Parklands" ,
68
68
"place_id" : " ChIJn6Vj-h8XLxgRs-qT2FfOt9E" ,
69
69
"average_rating" : 2.5 ,
70
70
"ratings" :[
Original file line number Diff line number Diff line change
1
+ const express = require ( 'express' ) ;
2
+ const router = express . Router ( ) ;
3
+ const fs = require ( 'fs' )
4
+ const restaurants = JSON . parse ( fs . readFileSync ( 'database/restaurants.json' , 'utf-8' ) )
5
+
6
+ // GET Restaurants
7
+ router . get ( '/' , function ( req , res , _next ) {
8
+ res . json ( restaurants )
9
+ } ) ;
10
+
11
+
12
+ module . exports = router ;
You can’t perform that action at this time.
0 commit comments