Socket
Book a DemoInstallSign in
Socket

gatsby-source-saphy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

gatsby-source-saphy

import products from saphy.net saas

unpublished
latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

gatsby-source-saphy

use saphy strore as a source to your gatsbyjs ecommerce website

Installation

    #NPM
    npm i --save gatsby-source-saphy
    #YARN
    yarn add gatsby-source-saphy

add the envirenment variable SAPHY_KEY=...

use in gatsby-config.js

    plugins: [
        //...
        {
            resolve:'gatsby-source-saphy',
            options:{
                SAPHY_KEY:"..."
            }
        }
    ]
    

query all product from your store using GraphQL


   exports.createPages = async ({ graphql, actions }) => {

    const { createPage } = actions;
    const postTempalte = path.resolve("./src/templates/post.js");

    return graphql(`
    query {
        allSaphy {
            edges {
              node {
                avatar
                name
                id
              }
            }
        }
    }
  `).then(result => {

        let alledges = result.data.allSaphy.edges
        alledges.forEach(({ node }) => {
            createPage({
                path: _.kebabCase(node.name),
                id: node.id,
                component: postTempalte,
                context: {
                    id: node.id
                }
            })
        })
    })

}

FAQs

Package last updated on 15 Mar 2020

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