-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathbuildData.js
147 lines (145 loc) · 4.22 KB
/
buildData.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
const fs = require('fs');
const restaurants = [
{
id: '1',
name: "Becky's Burgers",
priceRange: '$$',
imageSrc: '/images/1-burger.jpg',
imageDescription: 'A photo of a burger with fries and a milkshake',
description: 'Juicy burgers, crunchy fries, and creamy shakes',
menu: [
{ item: 'Cheeseburger', price: 9 },
{ item: 'Milkshake', price: 4 },
{ item: 'Meal (burger, fries, and shake)', price: 15 },
],
},
{
id: '2',
name: 'Chicken Nice',
priceRange: '$',
imageSrc: '/images/2-chicken-rice.jpg',
imageDescription: 'A photo of Hainanese chicken rice',
description: "The world's best Hainanese Chicken Rice",
menu: [
{ item: 'Steamed chicken rice', price: 4 },
{ item: 'Roast chicken rice', price: 4 },
{ item: 'Steamed chicken rice set', price: 6 },
],
},
{
id: '3',
name: "Nonna's pizza and pasta",
priceRange: '$$',
imageSrc: '/images/3-pizza.jpg',
imageDescription: 'A photo of a margherita pizza',
description: 'Classic pizza and pasta just like Nonna used to make',
menu: [
{ item: 'Margherita pizza', price: 10 },
{ item: 'Pepperoni pizza', price: 12 },
{ item: 'Spaghetti bolognese', price: 15 },
],
},
{
id: '4',
name: 'Super satay skewers',
priceRange: '$$',
imageSrc: '/images/4-satay.jpg',
imageDescription: 'A photo of some satay skewers with sauce',
description: "Satay so good it'll save the world",
menu: [
{ item: '10 chicken satay', price: 7 },
{ item: '10 mutton satay', price: 7 },
{ item: '10 beef satay', price: 7 },
],
},
{
id: '5',
name: 'Curry delights',
priceRange: '$$$',
imageSrc: '/images/5-curry.jpg',
imageDescription: 'A photo of Indian curries',
description: 'The best Indian curries from the freshest ingredients',
menu: [
{ item: 'Dal fry', price: 8 },
{ item: 'Garlic Naan', price: 3 },
{ item: 'Paneer Makhani ', price: 15 },
],
},
{
id: '6',
name: 'Sliced',
priceRange: '$',
imageSrc: '/images/6-sandwich.jpg',
imageDescription: 'A photo of a sandwich',
description: 'Fresh sandwiches at great prices',
menu: [
{ item: 'BLT (bacon, lettuce, tomato)', price: 7 },
{ item: 'Warm chicken sandwich', price: 6 },
{ item: 'Chicken caesar salad', price: 5 },
],
},
{
id: '7',
name: 'Taste of Iberia',
priceRange: '$$$$',
imageSrc: '/images/7-paella.jpg',
imageDescription: 'A photo of Spanish Paella',
description: 'Paella, tapas, and imported Spanish wines',
menu: [
{ item: 'Seafood paella', price: 25 },
{ item: 'Mixed tapas', price: 27 },
{ item: '2012 Barbazul (Red)', price: 70 },
],
},
{
id: '8',
name: 'Crunchy Crunch',
priceRange: '$$',
imageSrc: '/images/8-fried-chicken.jpg',
imageDescription: 'A photo of crispy fried chicken',
description: "The city's best Southern-style fried chicken",
menu: [
{ item: '6 pc. chicken', price: 12 },
{ item: '6 pc. boneless chicken', price: 15 },
{ item: '2 pc. biscuits', price: 5 },
],
},
{
id: '9',
name: "Japan's finest",
priceRange: '$$$',
imageSrc: '/images/9-sushi.jpg',
imageDescription: 'A photo of sushi and sashimi',
description: 'Only the freshest fish and tastiest katsu',
menu: [
{ item: 'Mixed sushi platter', price: 20 },
{ item: 'Mixed sashimi platter', price: 20 },
{ item: 'Chicken katsu curry set', price: 18 },
],
},
{
id: '10',
name: "Chippo's",
priceRange: '$',
imageSrc: '/images/10-fish-n-chips.jpg',
imageDescription: 'A photo of deep-fried fish with thick-cut hot chips',
description: 'Authentic Aussie-style fish n chips',
menu: [
{ item: 'Fish n chips for 1', price: 8 },
{ item: 'Potato cake', price: 1 },
{ item: 'Dim sim', price: 1 },
],
},
];
fs.writeFileSync('./content/restaurants.json', JSON.stringify(restaurants));
try {
fs.mkdirSync('./content/restaurants');
} catch (e) {
if (e.code !== 'EEXIST') throw e;
}
restaurants.forEach(restaurant => {
fs.writeFileSync(
`./content/restaurants/${restaurant.id}.json`,
JSON.stringify(restaurant),
);
});