Git Product home page Git Product logo

image-service's Introduction

361-Project

The following is a microservice implementation for my partner's 361 project. It is an API that is run locally. The code written in getJobs.js calls 2 github API sources that contain company names that are hiring for new grad roles and intern roles. When the API is called it returns a JS object of the company name and its logo.

In order to request data, a user should install node-fetch to gather the entire list of companys and logos. Also, prior to running the index.js file, please make sure Node and Express are installed. The file making a reqwuest to get the companies and the logos should also be named with a .mjs at the end of the file name. The code below is one example of how to request the data in JS:

import fetch from 'node-fetch';
let responseData;

// Make a GET request
fetch('http://localhost:5000')
  .then(response => {
    // Check if the request was successful (status code 2xx)
    if (!response.ok) {
      throw new Error(`Request failed with status: ${response.status}`);
    }
    // save the response from the api into responseData
    responseData = response;

  })
  // code to handle any errors
  .catch(error => {
    console.error('Error requesting data:', error.message);
  });

In order to receieve the data, ensure that you initialize a variable to the above GET request so the returned result can be accessed or stored. In the example above, the variable responseData is set as undefined so that it can get the data when the API is called.

The following UML Diagram displays the request and receiving data works with the API:

UMLdiagram

image-service's People

Contributors

kyak15 avatar cyreilv7 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.