Alexandre SOARES 4 years ago
parent
commit
91669afc54
  1. 24
      index.js
  2. 3906
      package-lock.json
  3. 5
      package.json

24
index.js

@ -12,6 +12,30 @@ app.post('/', async (req, res) => {
};
});
app.post('/cats', async (req, res) => {
var cats = (await axios.get('https://cat-fact.herokuapp.com/facts/random?animal_type=cat&amount=3')).data
return {
cats.map(cat => cat.text)
};
});
app.post('/foxes', async (req, res) => {
var foxes = (await axios.get('https://randomfox.ca/floof/')).data
return {
foxes.image
};
});
app.post('/holidays', async (req, res) => {
var holidays = (await axios.get('https://date.nager.at/api/v3/publicholidays/2022/' + countryCode)).data
return {
holidays
};
});
// Only used for dev server, do not remove
app.head('/', () => ({ ping: 'pong' }));

3906
package-lock.json
File diff suppressed because it is too large
View File

5
package.json

@ -11,8 +11,9 @@
"@babel/plugin-transform-destructuring": "^7.12.13",
"@babel/preset-env": "^7.12.16",
"@babel/preset-stage-3": "^7.8.3",
"axios": "^0.21.1",
"fastify": "^3.12.0",
"axios": "^0.21.4",
"fastify": "^3.27.1",
"node": "^17.4.0",
"nodemon": "^2.0.7",
"zod": "^3.11.6"
},

Loading…
Cancel
Save