-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed.js
72 lines (66 loc) · 1.95 KB
/
seed.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
//This file will allow us to send our application with data
var db = require('./models');
var neighborhoodList = [];
neighborhoodList.push({
name: "Financial District",
wikiUrl: "https://en.wikipedia.org/wiki/Financial_District,_San_Francisco",
image: "/images/embarcadero-fidi.jpg",
restaurants: [
{
name: "Kirimachi Ramen",
url: "http://kirimachi.com",
slurps: ["Love the Tsukemen Ramen!", "Try the Duck one!"]
},
{
name: "The Ramen Bar",
url: "http://theramenbar.com",
slurps: ["Tokyo Roast Chicken Ramen w/ egg!!"]
}
]
});
neighborhoodList.push({
name: "Japantown",
wikiUrl: "https://en.wikipedia.org/wiki/Japantown,_San_Francisco",
image: "/images/japantown.jpg",
restaurants: [
{
name: "Marufuku Ramen",
url: "http://marufukuramen.com",
slurps: ["Chicken Karaage!", "Hakata style ramen"]
},
{
name: "Hinodeya Ramen Bar",
url: "http://sasala-group.com/hinodeya",
slurps: ["Tori Paitan", "Black Sesame Icecream with granola!"]
}
]
});
neighborhoodList.push({
name: "Hayes Valley",
wikiUrl: "https://en.wikipedia.org/wiki/Hayes_Valley,_San_Francisco",
image: "/images/hayesvalley.jpg",
restaurants: [
{
name: "Nojo Ramen Tavern",
url: "https://nojosf.com",
slurps: ["Spicy Chicken Soboro Tossed Noodles", "Chicken Paitan Soy Sauce Ramen"]
},
{
name: "O-Toro Sushi",
url: "http://otorosushi.com",
slurps: ["Miso Ramen!", "Get sushi instead"]
}
]
});
db.Neighborhood.remove({}, function(err, neighborhood) {
console.log('removed all neighborhoods');
db.Neighborhood.create(neighborhoodList, function(err, neighborhood) {
if (err) {
console.log('ERROR', err);
return;
}
console.log("recreated ", neighborhood.length, " neighborhoods");
console.log("all neighborhoods: ", neighborhood);
process.exit();
}); //closes create function
}); //closes remove function