GithubHelp home page GithubHelp logo

tenebit-eng / news-article-from-techcrunch Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 8 KB

This is a pseudo Frontend application in which lists and displays the most recent published posts. News Articles API: https://techcrunch.com/wp-json/wp/v2/posts?per_page=20&context=embed

Home Page: https://technewsarticle.netlify.app/

HTML 18.29% JavaScript 55.63% CSS 26.08%
news tech techcrunch

news-article-from-techcrunch's Introduction

News-Article-From-TechCrunch

This is a pseudo Frontend application in which lists and displays the most recent published posts.

News Articles API: https://techcrunch.com/wp-json/wp/v2/posts?per_page=20&context=embed

<<<<<<< HEAD

This code includes several functions that work together to fetch and display a list of posts from the TechCrunch API.

First, there is the fetchPosts function, which makes an asynchronous call to the TechCrunch API and returns the response as JSON. If an error occurs during the fetch, the function will return null.

The createPostCard function takes a single post object and creates an HTML element that displays the post's title, excerpt, and image. The function also sets the href attribute of the post's title to the post's link, and adds an event listener to the post element that adds a "hover" class when the user hovers over the element.

The renderPostList function is the main function that fetches and displays the list of posts. It first creates a loader element, which is displayed while the posts are being fetched. Then, it calls the fetchPosts function and waits for the response. If the response is null, the function displays an error message. Otherwise, it clears the current content of the post list (if any) and creates and adds a post element for each post in the response. Finally, the function removes the loader element.

Overall, this code allows users to display a list of posts from the TechCrunch API on their webpage, with a loader displayed while the posts are being fetched. If an error occurs during the fetch, the code displays an error message instead of the post list.

======= >>>>>>> fd988d6e6c95ba05075ed278c506af061e8334e9

news-article-from-techcrunch's People

Contributors

tenebit-eng avatar

Stargazers

 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.