Alayna  Rippin

Alayna Rippin

1599984000

GraphQL: The Easy Way to Do the Hard Stuff

GraphQL is rapidly growing in popularity as the new standard for working with APIs, and it’s easy to see why! Performant and efficient, this groundbreaking API query language gives developers a single API endpoint to access exactly the data they need. Relationships and custom resolvers allow you to even further evolve your GraphQL API to access multiple data sources. With such extensibility, you can iterate even more quickly on front-end features your application users will love.

In this tutorial, we’ll walk through a comprehensive example starting only with data and build out an entire site using GraphQL - showing why it’s become so popular.

We’ll start by setting up a hosted, serverless, and secure GraphQL API for our data in minutes. Then we will extend that API with relationships to other data collections and custom resolvers in order to bundle together different data sources and APIs together under the same schema. Finally, we will build out a web application using our GraphQL endpoint to demonstrate how GraphQL gives us exactly the data we want - nothing more, nothing less.

Along the way, we’ll learn how to

  • automatically generate JSON schema for your MongoDB collections.
  • create types and resolvers for that data.
  • define custom query resolvers to access other databases or 3rd party APIs.
  • test your schema using the GraphiQL interface inside the Atlas UI.

#graphql

What is GEEK

Buddha Community

GraphQL: The Easy Way to Do the Hard Stuff

Elm Graphql: Autogenerate Type-safe GraphQL Queries in Elm

dillonkearns/elm-graphql  

Why use this package over the other available Elm GraphQL packages? This is the only one that generates type-safe code for your entire schema. Check out this blog post, Type-Safe & Composable GraphQL in Elm, to learn more about the motivation for this library. (It's also the only type-safe library with Elm 0.18 or 0.19 support, see this discourse thread).

I built this package because I wanted to have something that:

  1. Gives you type-safe GraphQL queries (if it compiles, it's valid according to the schema),
  2. Creates decoders for you in a seamless and failsafe way, and
  3. Eliminates GraphQL features in favor of Elm language constructs where possible for a simpler UX (for example, GraphQL variables & fragments should just be Elm functions, constants, lets).

See an example in action on Ellie. See more end-to-end example code in the examples/ folder.

Overview

dillonkearns/elm-graphql is an Elm package and accompanying command-line code generator that creates type-safe Elm code for your GraphQL endpoint. You don't write any decoders for your API with dillonkearns/elm-graphql, instead you simply select which fields you would like, similar to a standard GraphQL query but in Elm. For example, this GraphQL query

query {
  human(id: "1001") {
    name
    homePlanet
  }
}

would look like this in dillonkearns/elm-graphql (the code in this example that is prefixed with StarWars is auto-generated)

import Graphql.Operation exposing (RootQuery)
import Graphql.SelectionSet as SelectionSet exposing (SelectionSet)
import StarWars.Object
import StarWars.Object.Human as Human
import StarWars.Query as Query
import StarWars.Scalar exposing (Id(..))


query : SelectionSet (Maybe HumanData) RootQuery
query =
    Query.human { id = Id "1001" } humanSelection


type alias HumanData =
    { name : String
    , homePlanet : Maybe String
    }


humanSelection : SelectionSet HumanData StarWars.Object.Human
humanSelection =
    SelectionSet.map2 HumanData
        Human.name
        Human.homePlanet

GraphQL and Elm are a perfect match because GraphQL is used to enforce the types that your API takes as inputs and outputs, much like Elm's type system does within Elm. elm-graphql simply bridges this gap by making your Elm code aware of your GraphQL server's schema. If you are new to GraphQL, graphql.org/learn/ is an excellent way to learn the basics.

After following the installation instructions to install the @dillonkearns/elm-graphql NPM package and the proper Elm packages (see the Setup section for details). Once you've installed everything, running the elm-graphql code generation tool is as simple as this:

npx elm-graphql https://elm-graphql.herokuapp.com --base StarWars --output examples/src

If headers are required, such as a Bearer Token, the --header flag can be supplied.

npx elm-graphql https://elm-graphql.herokuapp.com --base StarWars --output examples/src --header 'headerKey: header value'

Learning Resources

There is a thorough tutorial in the SelectionSet docs. SelectionSets are the core concept in this library, so I recommend reading through the whole page (it's not very long!).

The examples/ folder is another great place to start.

If you want to learn more GraphQL basics, this is a great tutorial, and a short read: graphql.org/learn/

My Elm Conf 2018 talk goes into the philosophy behind dillonkearns/elm-graphql

Types Without Borders Elm Conf Talk

(Skip to 13:06 to go straight to the dillonkearns/elm-graphql demo).

If you're wondering why code is generated a certain way, you're likely to find an answer in the Frequently Asked Questions (FAQ).

There's a very helpful group of people in the #graphql channel in the Elm Slack. Don't hesitate to ask any questions about getting started, best practices, or just general GraphQL in there!

Setup

dillonkearns/elm-graphql generates Elm code that allows you to build up type-safe GraphQL requests. Here are the steps to setup dillonkearns/elm-graphql.

Add the dillonkearns/elm-graphql elm package as a dependency in your elm.json. You will also need to make sure that elm/json is a dependency of your project since the generated code has lots of JSON decoders in it.

elm install dillonkearns/elm-graphql
elm install elm/json

Install the @dillonkearns/elm-graphql command line tool through npm. This is what you will use to generate Elm code for your API. It is recommended that you save the @dillonkearns/elm-graphql command line tool as a dev dependency so that everyone on your project is using the same version.

npm install --save-dev @dillonkearns/elm-graphql
# you can now run it locally using `npx elm-graphql`,
# or by calling it through an npm script as in this project's package.json

Run the @dillonkearns/elm-graphql command line tool installed above to generate your code. If you used the --save-dev method above, you can simply create a script in your package.json like the following:

{
  "name": "star-wars-elm-graphql-project",
  "version": "1.0.0",
  "scripts": {
    "api": "elm-graphql https://elm-graphql.herokuapp.com/api --base StarWars"
  }

With the above in your package.json, running npm run api will generate dillonkearns/elm-graphql code for you to call in ./src/StarWars/. You can now use the generated code as in this Ellie example or in the examples folder.

Subscriptions Support

You can do real-time APIs using GraphQL Subscriptions and dillonkearns/elm-graphql. Just wire in the framework-specific JavaScript code for opening the WebSocket connection through a port. Here's a live demo and its source code. The demo server is running Elixir/Absinthe.

Contributors

Thank you Mario Martinez (martimatix) for all your feedback, the elm-format PR, and for the incredible logo design!

Thank you Mike Stock (mikeastock) for setting up Travis CI!

Thanks for the reserved words pull request @madsflensted!

A huge thanks to @xtian for doing the vast majority of the 0.19 upgrade work! :tada:

Thank you Josh Adams (@knewter) for the code example for Subscriptions with Elixir/Absinthe wired up through Elm ports!

Thank you Romario for adding OptionalArgument.map!

Thank you Aaron White for your pull request to improve the performance and stability of the elm-format step! 🎉

Roadmap

All core features are supported. That is, you can build any query or mutation with your dillonkearns/elm-graphql-generated code, and it is guaranteed to be valid according to your server's schema.

dillonkearns/elm-graphql will generate code for you to generate subscriptions and decode the responses, but it doesn't deal with the low-level details for how to send them over web sockets. To do that, you will need to use custom code or a package that knows how to communicate over websockets (or whichever protocol) to setup a subscription with your particular framework. See this discussion for why those details are not handled by this library directly.

I would love to hear feedback if you are using GraphQL Subscriptions. In particular, I'd love to see live code examples to drive any improvements to the Subscriptions design. Please ping me on Slack, drop a message in the #graphql channel, or open up a Github issue to discuss!

I would like to investigate generating helpers to make pagination simpler for Connections (based on the Relay Cursor Connections Specification). If you have ideas on this chime in on this thread.

See the full roadmap on Trello.


Author: dillonkearns
Source Code: https://github.com/dillonkearns/elm-graphql
License: View license

#graphql 

Alayna  Rippin

Alayna Rippin

1599984000

GraphQL: The Easy Way to Do the Hard Stuff

GraphQL is rapidly growing in popularity as the new standard for working with APIs, and it’s easy to see why! Performant and efficient, this groundbreaking API query language gives developers a single API endpoint to access exactly the data they need. Relationships and custom resolvers allow you to even further evolve your GraphQL API to access multiple data sources. With such extensibility, you can iterate even more quickly on front-end features your application users will love.

In this tutorial, we’ll walk through a comprehensive example starting only with data and build out an entire site using GraphQL - showing why it’s become so popular.

We’ll start by setting up a hosted, serverless, and secure GraphQL API for our data in minutes. Then we will extend that API with relationships to other data collections and custom resolvers in order to bundle together different data sources and APIs together under the same schema. Finally, we will build out a web application using our GraphQL endpoint to demonstrate how GraphQL gives us exactly the data we want - nothing more, nothing less.

Along the way, we’ll learn how to

  • automatically generate JSON schema for your MongoDB collections.
  • create types and resolvers for that data.
  • define custom query resolvers to access other databases or 3rd party APIs.
  • test your schema using the GraphiQL interface inside the Atlas UI.

#graphql

Delbert  Ferry

Delbert Ferry

1622105190

How to use GraphQL with Javascript – GraphQL.js tutorial

One of the fastest ways to get up and running with GraphQL is to install Apollo Server as middleware on your new or existing HTTP server.

In this short post, we demonstrate how to use Apollo Server to create a GraphQL server with Express.js using the [apollo-server-express] package. At the end, we’ll discuss the tradeoffs of this approach.

#graphql #javascript #graphql.js #graphql.js tutorial

Delbert  Ferry

Delbert Ferry

1622024357

Speak at GraphQL Summit!

At Apollo, we’ve been hard at work helping to showcase the amazing stories and projects that have surfaced in the past few months. We’ve organized one [GraphQL meetup] already and there’s another coming up [tomorrow].

With [all] [the] [amazing] [GraphQL] happening in conferences and meetups around the world, and the fact that there never seemed to be enough room in our meetup lineups for everyone we wanted to hear from, we decided it was time to plan a conference dedicated entirely to GraphQL.

#graphql #talk graphql #graphql summit

Crypto Like

Crypto Like

1605943454

What is HARD Protocol (HARD) | What is HARD Protocol token | What is HARD token

What is the HARD Protocol?

source : TokenClan

HARD is the world’s first cross-chain money market that enables you to earn more with your digital assets. With HARD you will now be able to lend, borrow, and earn with assets like BTC, XRP, BNB, BUSD, KAVA, and USDX.

It is the first of what will be many applications that utilize the Kava blockchain’s security, price feed module, and cross-chain functionality to provide open and decentralized financial services to the world.

How does the HARD Protocol Work?

There are three major activities:

  1. Supply — You can safely supply your digital assets on HARD and earn interest.
  2. Borrow — You can use your digital assets as collateral to borrow others.
  3. Earn — Suppliers and borrowers earn HARD, the governance token of the application.

How the HARD Protocol is Built

HARD is an application built on Kava, as such, it leverages Kava’s existing validators for security, bridges for cross-chain asset transfer, and partners services such as Chainlink oracles for price-reference data.

Version 1 of the HARD Protocol ships with support for supply-side deposits and HARD incentives for BTC, XRP, BNB, BUSD, USDX. Version 2 ships with borrow functionality and borrow-side incentives for those assets plus expanded functionality of HARD governance on-chain.

Initial Assets — BTC, BNB, BUSD, USDX, XRP, and HARD.

As an application built on Kava, it will have access to any asset on the Kava blockchain. In the Kava-4 “Gateway” mainnet upgrade, the BEP3 Bridge will be expanded to support BTC, XRP, BUSD and others making these assets available for use in HARD money markets along with native Kava assets like KAVA, HARD and USDX.

Open Integrations

Built as an open and permissionless application, HARD is accessible by anyone, anytime, anywhere in the world. Exchanges, Fintech apps, and financial institutions can integrate HARD’s money market products and provide earning and borrowing opportunities directly to their users.

HARD Governance

As seen in all decentralized money market applications today, a governance token is necessary for proper decentralization and to ensure the ongoing evolution of the application. To compete in the current environment it’s also critical to have incentives to bootstrap liquidity and incentivize user participation.

The HARD token — decentralized governance and incentives.

The HARD token primary role is to give holders a voice in the platform. Collectively, HARD holders are responsible for managing key parameters of the protocol such as what assets are to be offered, how rewards are distributed amongst assets, as well as set any platform fees, etc.

HARD tokens will also be used to incentivize early participants giving them a voice in the ongoing evolution and management of the application.

KAVA Tokens and Compensation

In designing HARD, it was carefully evaluated if the KAVA token could be used to also govern the application. Three major items prevented this:

  1. HARD’s evolution needs to be driven by the participants that use it. We believe that a fair distribution to users is necessary for long term success. The users of HARD money markets may or may not be the same as those that hold KAVA today giving reason to not conflate the governance of the Kava blockchain with that of the application.
  2. Having supplier and borrower incentives is a must in today’s yield oriented DeFi market. If we used the KAVA token for incentives on HARD, we would need to inflate KAVA upwards of 50% supply. Given that not all KAVA holders would be participants on HARD, inflating KAVA would meaningfully dilute existing KAVA holders to a degree that is not acceptable.
  3. Lastly, the KAVA token needs to be preserved as a reserve asset responsible for recapitalizing the lending platform. Conflating its value in multiple use cases creates a cascade of problems and can potentially undermine its value as a reserve asset.

HARD Compensation for KAVA Stakers

HARD and any other applications that utilizes the Kava blockchain’s security should in theory compensate KAVA stakers directly for that security and cross-chain infrastructure. As such, we felt it was appropriate that HARD tokens should be distributed continuously, pro-rata, amongst KAVA stakers.

HARD Distribution

Image for post

A detailed release schedule can be found on this spreadsheet

There will be a max supply of 200M HARD tokens. The distribution of HARD tokens will be as follows:

40% — Incentives for Suppliers & Borrowers

25% — Treasury

20% — Kava Stakers

10% — Team

5% — IEO

Note: To achieve a fair distribution there will not be any seed or private sale of the HARD tokens.

Development Roadmap

  1. September 21st, 2020 — Testnet of HARD v1
  • Internal testing.
  • External audit.

2. October 15th, 2020 — HARD v1 ships along with Kava-4 “Gateway” upgrade

  • HARD distribution begins.
  • Supply-side deposits and HARD incentives for BTC, BNB, HARD, & USDX begin.

3. December 30th, 2020 — HARD v2

  • Expanded HARD governance.
  • Supply & borrow — BTC, XRP, BNB, BUSD, USDX and LINK.
  • Borrow-side incentives begin — BTC, BNB, BUSD, LINK, USDX & XRP.

Learn about Cryptocurrency in this article ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner

Would you like to earn HARD right now! ☞ CLICK HERE

How and Where to Buy HARD?

HARD has been listed on a number of crypto exchanges, unlike other main cryptocurrencies, it cannot be directly purchased with fiats money. However, You can still easily buy this coin by first buying Bitcoin, ETH, USDT from any large exchanges and then transfer to the exchange that offers to trade this coin, in this guide article we will walk you through in detail the steps to buy HARD

You will have to first buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT)…

We will use Binance Exchange here as it is one of the largest crypto exchanges that accept fiat deposits.

Binance is a popular cryptocurrency exchange which was started in China but then moved their headquarters to the crypto-friendly Island of Malta in the EU. Binance is popular for its crypto to crypto exchange services. Binance exploded onto the scene in the mania of 2017 and has since gone on to become the top crypto exchange in the world.

Once you finished the KYC process. You will be asked to add a payment method. Here you can either choose to provide a credit/debit card or use a bank transfer, and buy one of the major cryptocurrencies, usually either Bitcoin (BTC), Ethereum (ETH), Tether (USDT)

SIGN UP ON BINANCE

Step by Step Guide : What is Binance | How to Create an account on Binance (Updated 2021)

After the deposit is confirmed you may then purchase HARD from the exchange.

Exchange: Binance, WBF Exchange, Gate.io, MXC.COM, and Coinone

Apart from the exchange(s) above, there are a few popular crypto exchanges where they have decent daily trading volumes and a huge user base. This will ensure you will be able to sell your coins at any time and the fees will usually be lower. It is suggested that you also register on these exchanges since once HARD gets listed there it will attract a large amount of trading volumes from the users there, that means you will be having some great trading opportunities!

Top exchanges for token-coin trading. Follow instructions and make unlimited money

https://www.binance.com
https://www.bittrex.com
https://www.poloniex.com
https://www.bitfinex.com
https://www.huobi.com
https://www.mxc.ai
https://www.probit.com
https://www.gate.io
https://www.coinbase.com

Find more information HARD

☞ Website
☞ Explorer
☞ Social Channel
☞ Coinmarketcap

Thank for visiting and reading this article! I’m highly appreciate your actions! Please share if you liked it!

#blockchain #bitcoin #cryptocurrency #hard protocol #hard