-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate restaurant data files from a script
- Loading branch information
1 parent
643176e
commit d1587ea
Showing
17 changed files
with
107 additions
and
88 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
content/restaurants* |
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
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,93 @@ | ||
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', | ||
description: 'Juicy burgers, crunchy fries, and creamy shakes', | ||
}, | ||
{ | ||
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", | ||
}, | ||
{ | ||
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', | ||
}, | ||
{ | ||
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", | ||
}, | ||
{ | ||
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', | ||
}, | ||
{ | ||
id: '6', | ||
name: 'Sliced', | ||
priceRange: '$', | ||
imageSrc: '/images/6-sandwich.jpg', | ||
imageDescription: 'A photo of a sandwich', | ||
description: 'Fresh sandwhiches at great prices', | ||
}, | ||
{ | ||
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', | ||
}, | ||
{ | ||
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", | ||
}, | ||
{ | ||
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', | ||
}, | ||
{ | ||
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', | ||
}, | ||
]; | ||
|
||
fs.writeFileSync('./content/restaurants.json', JSON.stringify(restaurants)); | ||
fs.mkdirSync('./content/restaurants'); | ||
restaurants.forEach(restaurant => { | ||
fs.writeFileSync( | ||
`./content/restaurants/${restaurant.id}.json`, | ||
JSON.stringify(restaurant), | ||
); | ||
}); |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
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