forked from HX-MPrecelle/api-restaurant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (30 loc) · 1006 Bytes
/
index.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
const server = require('./src/app.js');
const { conn } = require('./src/db.js');
// Syncing all the models at once.
conn.sync({ force: true })
.then(() => {
server.listen(3001, () => {
console.log('%s listening at 3001');
});
});
// Syncing all the models at once.
// conn.sync({ force: true }).then(() => {
// server.listen(3001, async () => {
// let apiURL = await axios.get(`https://restcountries.com/v3.1/all`);
// apiURL = apiURL.data;
// let apiInfo = apiURL.forEach(async (country) => {
// Country.create({
// id: country.cca3,
// name: country.name.common,
// flags: country.flags.png,
// continent: country.region,
// capital: country.capital ? country.capital : [],
// area: country.area ,
// subregion: country.subregion,
// population: country.population,
// });
// });
// console.log("%s listening at 3001"); // eslint-disable-line no-console
// return apiInfo;
// });
// });