New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-source-nasa

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-nasa

A Gatsby source plugin to load images from the NASA API.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-source-nasa

This source plugin for Gatsby will make NASA image URLs available in GraphQL queries.

Installation

# Install the plugin
yarn add gatsby-source-nasa

In gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-nasa',
      options: {
        key: "YOUR_NASA_API_KEY",
        images: [
          {
            type: 'apod',
            date:
          },
          {
            type: 'epic',
            date:
          }
        ]
      },
    }
  ]
};

NOTE: To get a NASA API key, register here.

Configuration Options

The configuration options for this plugin are currently very small. You can set 'apod' and/or 'epic' types and provide an optional date in YYYY-MM-DD format.

Example Configuration

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-nasa',
      options: {
        key: process.env.NASA_API_KEY,
        images: [
          {
            type: 'apod',
            date: '2019-01-01'
          },
          {
            type: 'epic',
            date: '2019-01-01'
          }
        ]
      }
    }
  ]
};

Querying NASA image information

Once the plugin is configured, one new query is available in GraphQL: allNasaData.

Here are example queries to load APOD and EPIC images:

query ApodQuery {
  allNasaData(filter: {type: {eq: "apod"}}) {
    edges {
      node {
        type
        date
        url
      }
    }
  }
}
query EpicQuery {
  allNasaData(filter: {type: {eq: "epic"}}) {
    edges {
      node {
        type
        date
        url
      }
    }
  }
}

See the GraphiQL UI for info on all returned fields.

Keywords

FAQs

Package last updated on 18 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc