forked from cerc-io/ipld-eth-server
Remove old deps
This commit is contained in:
parent
a1adf0e7fc
commit
ec796d9813
@ -39,8 +39,6 @@ By default, this build will expose only the "public" schema - to add other schem
|
|||||||
|
|
||||||
Install dependencies with `yarn` and execute `yarn build`. The bundle produced by Webpack will be present in `build/dist/`.
|
Install dependencies with `yarn` and execute `yarn build`. The bundle produced by Webpack will be present in `build/dist/`.
|
||||||
|
|
||||||
This application currently uses the Postgraphile supporter plugin. This plugin is present in the `vendor/` directory and is copied to `node_modules/` after installation of packages. It is a fresh checkout of the plugin as of August 31st, 2018.
|
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
Provide the built bundle to node as a runnable script: `node ./build/dist/vulcanize-postgraphile-server.js`
|
Provide the built bundle to node as a runnable script: `node ./build/dist/vulcanize-postgraphile-server.js`
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rm -rf ./build/dist && webpack --config=./webpack.config.js",
|
"build": "rm -rf ./build/dist && webpack --config=./webpack.config.js",
|
||||||
"lint": "tslint --project ./tsconfig.json --config ./tslint.json",
|
"lint": "tslint --project ./tsconfig.json --config ./tslint.json",
|
||||||
"postinstall": "rm -rf node_modules/@graphile && mkdir node_modules/@graphile && cp -R ./vendor/postgraphile-supporter/ ./node_modules/@graphile/plugin-supporter/",
|
|
||||||
"start": "npm run build && node ./build/dist/vulcanize-postgraphile-server.js",
|
"start": "npm run build && node ./build/dist/vulcanize-postgraphile-server.js",
|
||||||
"dev": "./node_modules/typescript/bin/tsc && node build/dist/src/index.js",
|
"dev": "./node_modules/typescript/bin/tsc && node build/dist/src/index.js",
|
||||||
"test": "rm -rf ./build/spec && tsc --build ./tsconfig.test.json && jasmine --config=./spec/support/jasmine.json",
|
"test": "rm -rf ./build/spec && tsc --build ./tsconfig.test.json && jasmine --config=./spec/support/jasmine.json",
|
||||||
|
@ -33,7 +33,6 @@ describe('buildServerConfig', () => {
|
|||||||
|
|
||||||
serverUtilities = {
|
serverUtilities = {
|
||||||
pluginHook: jasmine.createSpy('pluginHook'),
|
pluginHook: jasmine.createSpy('pluginHook'),
|
||||||
enableSubscriptions: jasmine.createSpy('enableSubscriptions'),
|
|
||||||
express: jasmine.createSpy('express'),
|
express: jasmine.createSpy('express'),
|
||||||
expressSession: jasmine.createSpy('expressSession'),
|
expressSession: jasmine.createSpy('expressSession'),
|
||||||
httpServerFactory: jasmine.createSpy('httpServerFactory'),
|
httpServerFactory: jasmine.createSpy('httpServerFactory'),
|
||||||
@ -67,10 +66,6 @@ describe('buildServerConfig', () => {
|
|||||||
expect(serverConfig.options).not.toBeNull();
|
expect(serverConfig.options).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('enables simple subscriptions', () => {
|
|
||||||
expect(serverConfig.options.simpleSubscriptions).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('it adds the express session handler as the first middleware', () => {
|
it('it adds the express session handler as the first middleware', () => {
|
||||||
expect(serverConfig.options.webSocketMiddlewares[0])
|
expect(serverConfig.options.webSocketMiddlewares[0])
|
||||||
.toBe(expressSessionHandler);
|
.toBe(expressSessionHandler);
|
||||||
|
@ -15,7 +15,6 @@ describe('bootServer', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
serverUtilities = {
|
serverUtilities = {
|
||||||
pluginHook: jasmine.createSpy('pluginHook'),
|
pluginHook: jasmine.createSpy('pluginHook'),
|
||||||
enableSubscriptions: jasmine.createSpy('enableSubscriptions'),
|
|
||||||
express: jasmine.createSpy('express'),
|
express: jasmine.createSpy('express'),
|
||||||
expressSession: jasmine.createSpy('expressSession'),
|
expressSession: jasmine.createSpy('expressSession'),
|
||||||
httpServerFactory: jasmine.createSpy('httpServerFactory'),
|
httpServerFactory: jasmine.createSpy('httpServerFactory'),
|
||||||
@ -34,7 +33,6 @@ describe('bootServer', () => {
|
|||||||
ignoreRBAC: false,
|
ignoreRBAC: false,
|
||||||
ownerConnectionString: '',
|
ownerConnectionString: '',
|
||||||
pluginHook: jasmine.createSpy('pluginHook'),
|
pluginHook: jasmine.createSpy('pluginHook'),
|
||||||
simpleSubscriptions: true,
|
|
||||||
watchPg: true,
|
watchPg: true,
|
||||||
webSocketMiddlewares: [] },
|
webSocketMiddlewares: [] },
|
||||||
port: 5678
|
port: 5678
|
||||||
@ -61,14 +59,6 @@ describe('bootServer', () => {
|
|||||||
expect(useSpy).toHaveBeenCalledWith(serverConfig.middleware);
|
expect(useSpy).toHaveBeenCalledWith(serverConfig.middleware);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('enahances the Node HTTP server with Postgraphile subscriptions', () => {
|
|
||||||
expect(serverUtilities.enableSubscriptions)
|
|
||||||
.toHaveBeenCalledWith(
|
|
||||||
mockHttpServer,
|
|
||||||
serverConfig.middleware,
|
|
||||||
serverConfig.options);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('instructs the server to listen on the given port', () => {
|
it('instructs the server to listen on the given port', () => {
|
||||||
const listenSpy = mockHttpServer.listen as jasmine.Spy;
|
const listenSpy = mockHttpServer.listen as jasmine.Spy;
|
||||||
expect(listenSpy).toHaveBeenCalledWith(serverConfig.port);
|
expect(listenSpy).toHaveBeenCalledWith(serverConfig.port);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { RequestHandler } from 'express';
|
import { RequestHandler } from 'express';
|
||||||
import { Server } from 'http';
|
import {PluginHookFn } from 'postgraphile/build/postgraphile/pluginHook';
|
||||||
import {PluginHookFn, PostGraphilePlugin} from 'postgraphile/build/postgraphile/pluginHook';
|
|
||||||
import {Plugin} from 'postgraphile';
|
import {Plugin} from 'postgraphile';
|
||||||
|
|
||||||
// NOTE: Shape of the middleware is not
|
// NOTE: Shape of the middleware is not
|
||||||
@ -18,7 +17,6 @@ export interface PostgraphileOptions {
|
|||||||
ignoreRBAC: boolean;
|
ignoreRBAC: boolean;
|
||||||
ownerConnectionString: string;
|
ownerConnectionString: string;
|
||||||
pluginHook: PluginHookFn;
|
pluginHook: PluginHookFn;
|
||||||
simpleSubscriptions: boolean;
|
|
||||||
watchPg: boolean;
|
watchPg: boolean;
|
||||||
// NOTE Shape of the middlewares is not
|
// NOTE Shape of the middlewares is not
|
||||||
// currently important to this application, but if a need arises,
|
// currently important to this application, but if a need arises,
|
||||||
@ -32,8 +30,3 @@ export type PostgraphileInitCallback = (
|
|||||||
options: PostgraphileOptions
|
options: PostgraphileOptions
|
||||||
) => PostgraphileMiddleware;
|
) => PostgraphileMiddleware;
|
||||||
|
|
||||||
export type AddSubscriptionsCallback = (
|
|
||||||
httpServer: Server,
|
|
||||||
middleware: PostgraphileMiddleware,
|
|
||||||
options: PostgraphileOptions
|
|
||||||
) => void;
|
|
||||||
|
@ -7,11 +7,7 @@ import passport = require('passport');
|
|||||||
import session = require('express-session');
|
import session = require('express-session');
|
||||||
import toml = require('toml');
|
import toml = require('toml');
|
||||||
|
|
||||||
const {
|
const pluginHook = makePluginHook([]);
|
||||||
default: PostGraphileSupporter,
|
|
||||||
enhanceHttpServerWithSubscriptions,
|
|
||||||
} = require('@graphile/plugin-supporter');
|
|
||||||
const pluginHook = makePluginHook([PostGraphileSupporter]);
|
|
||||||
|
|
||||||
import { ServerUtilities } from './server/interface';
|
import { ServerUtilities } from './server/interface';
|
||||||
import { bootServer } from './server/runtime';
|
import { bootServer } from './server/runtime';
|
||||||
@ -27,7 +23,6 @@ const configPath = process.env[CONFIG_PATH_KEY];
|
|||||||
const serverPort = process.env[SERVER_PORT_KEY];
|
const serverPort = process.env[SERVER_PORT_KEY];
|
||||||
|
|
||||||
const serverUtilities: ServerUtilities = {
|
const serverUtilities: ServerUtilities = {
|
||||||
enableSubscriptions: enhanceHttpServerWithSubscriptions,
|
|
||||||
express,
|
express,
|
||||||
expressSession: session,
|
expressSession: session,
|
||||||
httpServerFactory: createServer,
|
httpServerFactory: createServer,
|
||||||
|
@ -34,7 +34,6 @@ export function buildServerConfig(
|
|||||||
ignoreRBAC: false,
|
ignoreRBAC: false,
|
||||||
ownerConnectionString: databaseConfig.ownerConnectionString,
|
ownerConnectionString: databaseConfig.ownerConnectionString,
|
||||||
pluginHook: pluginHook,
|
pluginHook: pluginHook,
|
||||||
simpleSubscriptions: true,
|
|
||||||
watchPg: true,
|
watchPg: true,
|
||||||
webSocketMiddlewares: [
|
webSocketMiddlewares: [
|
||||||
expressSessionHandler,
|
expressSessionHandler,
|
||||||
|
@ -7,7 +7,6 @@ import {
|
|||||||
} from '../adapters/session';
|
} from '../adapters/session';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AddSubscriptionsCallback,
|
|
||||||
PostgraphileInitCallback,
|
PostgraphileInitCallback,
|
||||||
PostgraphileMiddleware,
|
PostgraphileMiddleware,
|
||||||
PostgraphileOptions
|
PostgraphileOptions
|
||||||
@ -28,7 +27,6 @@ export interface ServerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ServerUtilities {
|
export interface ServerUtilities {
|
||||||
enableSubscriptions: AddSubscriptionsCallback;
|
|
||||||
express: ExpressInitCallback;
|
express: ExpressInitCallback;
|
||||||
expressSession: ExpressSessionInitCallback;
|
expressSession: ExpressSessionInitCallback;
|
||||||
httpServerFactory: CreateHttpServerCallback;
|
httpServerFactory: CreateHttpServerCallback;
|
||||||
|
@ -9,10 +9,5 @@ export function bootServer(
|
|||||||
|
|
||||||
const httpServer = utilities.httpServerFactory(expressApp);
|
const httpServer = utilities.httpServerFactory(expressApp);
|
||||||
|
|
||||||
utilities.enableSubscriptions(
|
|
||||||
httpServer,
|
|
||||||
config.middleware,
|
|
||||||
config.options);
|
|
||||||
|
|
||||||
httpServer.listen(config.port);
|
httpServer.listen(config.port);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user