Skip to content

Commit

Permalink
Add dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
henkesn committed Jun 28, 2023
1 parent 4074347 commit 1f3ff4d
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 41 deletions.
25 changes: 25 additions & 0 deletions dev/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { soapGraphqlSchema } from '../src';
import { createHandler } from 'graphql-http/lib/use/http';
import * as http from 'http';

// http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL
// http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL
// https://www.uid-wse.admin.ch/V5.0/PublicServices.svc?WSDL

soapGraphqlSchema({
debug: true,
createClient: {
url: 'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL',
},
}).then((schema) => {
const handler = createHandler({ schema });
const server = http.createServer((req, res) => {
if (req.url.startsWith('/graphql')) {
handler(req, res);
} else {
res.writeHead(404).end();
}
});
server.listen(4000);
console.log(`serving graphql on http://localhost:4000/graphql`);
});
2 changes: 2 additions & 0 deletions dev/start-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('ts-node').register({ lazy: true });
require('./index');
Loading

0 comments on commit 1f3ff4d

Please sign in to comment.