npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@visionagency/feathers-plus-graphql

v1.10.0

Published

A modified high performance GraphQL adapter for SQL and non-SQL databases.

Downloads

8

Readme

@feathers-plus/graphql

A modified high performance GraphQL adapter for SQL and non-SQL databases. *This package is a modified @feathers-plus/graphql version with the latest graphql dependencies.

Configuring the adapter

You can configure Feathers services using the @feathers-plus/graphql adapter as shown in the docs. The adapter can be configured to use either

  • normal Feathers services,
  • Feathers services with BatchLoaders, or
  • raw SQL statements.

Press the appropriate Show button in the docs to see the relevant code.

Examples

As you can see, the adapter requires multiple working parts in order to configure the GraphQL instance properly. That's just how GraphQL is.

@feathers-plus/cli-generate-example contains 10 working examples of using the GraphQL adapter. They all use the same database and test harness. You should refer to them while reading the docs.

The examples are:

folder name | language | database | resolver functions :-|:-|:-|:-| js-nedb-services | JavaScript | NeDB | plain Feathers calls js-nedb-batchloaders | JavaScript | NeDB | BatchLoader calls js-sequelize-services | JavaScript | Sequelize + SQLite | plain Feathers calls js-sequelize-batchloaders | JavaScript | Sequelize + SQLite | BatchLoader calls js-sequelize-sql | JavaScript | Sequelize + SQLite | raw SQL statements ts-nedb-services | TypeScript | NeDB | plain Feathers calls ts-nedb-batchloaders | TypeScript | NeDB | BatchLoader calls ts-sequelize-services | TypeScript | Sequelize + SQLite | plain Feathers calls ts-sequelize-batchloaders | TypeScript | Sequelize + SQLite | BatchLoader calls ts-sequelize-sql | TypeScript | Sequelize + SQLite | raw SQL statements

Resolver Functions

GraphQL is a wrapper around resolver functions you have to provide. You'll be familiar with resolvers if you've used the fastJoin common hook, as fastJoin's design is based on GraphQL.

You will find that you need to write lots of resolver functions for a non-trivial app. For some insight, look at this relatively simple example involving just 5 tables.

Most of the effort in using GraphQL will be devoted to writing lots of resolver functions.

The above example uses normal Feathers service calls, without caching, without batching. You would see an approximate ten-fold performance improvement is you used Feathers service calls in conjunction with BatchLoaders. These types of resolver functions would be more complicated.

Finally, you may consider resolver functions which produce raw SQL statements if you are using an SQL database with Sequelize or Knex. This may very well result in a performance improvement over BatchLoaders but you would have to use something like join-monster along with resolver functions.

Generating Resolver Functions

@feathers-plus/cli, a.k.a. cli+, was written to automatically generate the resolver functions for you. You can customize the resulting resolver code if necessary.

example generate graphql

The examples in @feathers-plus/cli-generate-example were all written with cli+ and you can use cli+ to modify them.

REST and GraphQL

REST and GraphQL are totally different. Each is dope if used for the right thing.

FeathersJS, using cli+, now supports both REST and GraphQL architectural concepts and their query languages.

License

Copyright (c) 2018

Licensed under the MIT license.