Code Monkey home page Code Monkey logo

cat-fact-generator's Introduction

Cat Fact Generator

A Node.js generator app that is fetching and displaying data from multiple APIs.

Built with following software

  • Express.js
  • node-fetch
  • dotenv
  • nodemon

This was a fun project to build and a good exercise in how to use multiple sources of API and display them asynchronously using HTML, JavaScript and CSS.

I also had to do some refactoring and configurations since I updated Node.js to version 18, which lead to some complications. This s what I learned:

I was building a project using Express.js and the app kept crashing all the time because I had updated Node.js to version 18. What I didn't know was that with the new update, Node.js has changed how to import packages and files. First of all, you are now using an asynchronous ES module loader. This requires us to make some configurations.

  • Instead of using the "require" statement (const express = require('express')) you now have to use the import statement (import express from 'express').
  • You also need to change the extension from index.js to index.mjs for it to work. From what I understand you can still use the .js extension but then you will have to configure your package.json file and set it to "type": "module". Hope this helps. It took me a while to understand the issues the new update brought with it.

On to the next project. Happy coding!

cat-fact-generator's People

Contributors

sonnystark avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.