Browse Source

edit index 🔧

main
BuildTools 5 years ago
parent
commit
5b218ba5d4
  1. 21
      index.js
  2. 3029
      package-lock.json

21
index.js

@ -1,21 +1,32 @@
import fastify from 'fastify';
// see axios doc on how to use it
import axios from 'axios';
const app = fastify({ logger: true });
app.get('/', async (req, res) => {
return {
message: `Welcome to Node Babel with ${
req.body?.testValue ?? 'no testValue'
}`,
catfacts: getCatFacts(),
foxes: getFoxDay(),
day: getDayOfCountry()
};
});
// Run the server!
const getCatFacts = async(id) =>{
axios.get('https://cat-fact.herokuapp.com/facts/{id}').then(res => {});
};
const getFoxDay = async(id) =>{
axios.get('https://randomfox.ca/floof/').then(res => {});
};
const getDayOfCountry = async(id) =>{
axios.get('https://randomfox.ca/floof/').then(res => {});
};
const start = async () => {
try {
await app.listen(5000);
getCatFacts(1);
} catch (err) {
app.log.error(err);
process.exit(1);

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

Loading…
Cancel
Save