Learn Web development through Challenge #01 - Node JS

Veröffentlicht am: 19 November 2022
auf dem Kanal: Code With Marish
63
1

Hello friends, Today we are starting a new approach to learn coding while will help you in diving into real world scenarios, so it wouldn't be regular tutorials. In this challenge we will build Node JS CLI app where we will type commands to fetch data from PokeAPI as shown in the demo below.

Below are the steps you can follow
1. Initialize Node JS Project
2. Update package.json to run index.js
3. Create function to fetch pokemon details using axios. Refer :https://www.npmjs.com/package/axios
4. As shown in the above demo we used two commands. you can refer the PokeAPI docs(https://pokeapi.co/)
5. To get pokemon list
https://pokeapi.co/api/v2/pokemon?off...
To get specific pokemon - https://pokeapi.co/api/v2/pokemon/pok...
6. Import readline and accept input, use this input to pass it to api.You can refer node js docs for readline usage
https://nodejs.org/api/readline.html.
7. Extract data you need from response and Display the result in console
8. You can have fun by formatting fonts and colors in console by using ANSI escape codes.
For eg: to display error i have used bold and red color console.log("\x1b[1m\x1b[31m%s\x1b[0m", error);
9. Ideas are endless you can style the way you want. You can refer to below site for codes.
https://tforgione.fr/posts/ansi-escap...


Auf dieser Seite können Sie das Online-Video Learn Web development through Challenge #01 - Node JS mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Code With Marish 19 November 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 63 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!