This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
tstatic/tests/helpers.ts
2018-03-15 21:40:35 +00:00

14 lines
456 B
TypeScript

import createServer from '../src/server';
import { IOptions } from '../src/types';
import fetch from 'node-fetch';
export function runServer(opts: Object, url : string, callback: Function) {
const app = createServer(opts as IOptions);
const server = app.listen(1234, function () {
return fetch('http://0.0.0.0:1234' + url).then(function (response : any) {
server.close();
callback(response);
});
});
}