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