1.0.1 • Published 7 years ago

sails-hook-mlprciographql v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Stories in Ready Build Status

sails-hook-mlprciographql

About

A sails hook aimed at simplifying GraphQL integration.

Installation

npm install --save sails-hook-mlprciographql

Usage

After installing, (and configuring the database to your liking) you can summon ´sails.graphql´ to receive a Promise like so:

//For the default controller
index(req, res) {
    sails.graphql(req)
    .then((result) => {
      //Very important statements
      return res.json(result.data);
    })
    .catch((err)=>{
      //Oops.
      res.send(500, err);
    });
  }