Socket
Book a DemoInstallSign in
Socket

@antstackio/express-graphql-proxy

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons

@antstackio/express-graphql-proxy

a proxy server built on top of express.js for graphql services.

unpublished
Source
npmnpm
Version
0.2.8
Version published
Weekly downloads
1
-50%
Maintainers
4
Weekly downloads
 
Created
Source

express-graphql-proxy

A graphql proxy server implemented on top of express for adding custom RBAC to existing graphql endpoints.

import { createApp } from '@antstackio/express-graphql-proxy'

const requestParams = {
	resourceUri: "https://graphql-pokemon2.vercel.app",
  headers
};

const app = createApp(
	requestParams,
	handlerFunc
);

const handlers = {
	query: {
		pokemons
	}
};

function pokemons(variables, selectionFields, {req, res}) {
	if(parseInt(variables.id) > 150) {
		return res.status(400).send("cant query pokemons > 150 in this league"); 
	}
	return true;
}

function HandlerFunc(gqlObject, context) {

  const result = gqlObject.queryObjects.every((item) =>
    // map the gqlObject to a suitable handler
    handlers[gqlObject.type][item.operationName](
      item.variables,
      item.selectedFields,
      context
    )
  );
  return result;
}

Installation

This is a node.js module available through npm registry. Installation can be done using npm or yarn.

$ npm install @antstackio/express-graphql-proxy

$ yarn add @antstackio/express-graphql-proxy

Philosophy

There are services that provide graphql endpoints over http leaving the developer to come up with their own mechanism for authorisation and controllings permission for the access of resources. This library help in bootstrapping a middleware proxy server that makes it easy to implement RBAC without loosing the fun in using graphql from the client.

Documentation

  • Api documentation

Examples

check out the example folder for quick start.

FAQs

Package last updated on 24 Nov 2025

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