edge
edge copied to clipboard
Using edge from a graphql server
Hi I am trying to call an edge function from inside a running graphql server (running on express) but it cannot find my assembly:
var edge = require('edge');
var clrMethod = edge.func({ assemblyFile: 'SystemDot.MessageRouteInspector.Server.dll', typeName: 'SystemDot.MessageRouteInspector.Server.RequestDispatcher', methodName: 'DispatchRequest' });
module.exports = function(request, onResponse) { clrMethod(null, function (error, result) { if (error) throw error; onResponse(result); }); }
Running my graphql query returns:
{ "data": { "app": { "routes": null } }, "errors": [ { "message": "Could not load file or assembly 'file:///E:\Work\MessageRouteInspector\SystemDot.MessageRouteInspector.Server.dll' or one of its dependencies. The system cannot find the file specified.", "locations": [ { "line": 1, "column": 6 } ] } ] }
I am using the realy starter kit () Please help. https://github.com/relayjs/relay-starter-kit.
Here is the script that runs my server:
import express from 'express'; import graphQLHTTP from 'express-graphql'; import path from 'path'; import webpack from 'webpack'; import WebpackDevServer from 'webpack-dev-server'; import {Schema} from './data/schema';
const APP_PORT = 3001; const GRAPHQL_PORT = 8081;
// Expose a GraphQL endpoint
var graphQLServer = express();
graphQLServer.use('/', graphQLHTTP({schema: Schema, pretty: true}));
graphQLServer.listen(GRAPHQL_PORT, () => console.log(
GraphQL Server is now running on http://localhost:${GRAPHQL_PORT}
));
// Serve the Relay app
var compiler = webpack({
entry: path.resolve(__dirname, 'js', 'app.js'),
module: {
loaders: [
{
test: /.js$/,
loader: 'babel',
query: {stage: 0, plugins: ['./build/babelRelayPlugin']}
}
]
},
output: {filename: 'app.js', path: '/'}
});
var app = new WebpackDevServer(compiler, {
contentBase: '/public/',
proxy: {'/graphql': http://localhost:${GRAPHQL_PORT}
},
publicPath: '/js/',
stats: {colors: true}
});
// Serve static resources
app.use('/', express.static('public'));
app.use('/node_modules/react', express.static('node_modules/react'));
app.use('/node_modules/react-relay', express.static('node_modules/react-relay'));
app.listen(APP_PORT, () => {
console.log(App is now running on http://localhost:${APP_PORT}
);
});