Skip to content

Instantly share code, notes, and snippets.

@TracyNgot TracyNgot/mock.ts
Created Nov 22, 2018

Embed
What would you like to do?
Mock Server With ExpressJS, Typescript and JSON
interface Mock {
pathname: string;
method: string;
status: number;
responseBody: JSON;
}
class MockRoutes {
mockRoutes: Mock[] = [];
constructor() {
this.initMockRoutes();
}
private initMockRoutes() {
this.mockRoutes.push({
pathname: '/your-path',
method: 'GET',
status: 200,
responseBody: require('../mocks/response.json')
});
}
}
export default new MockRoutes().mockRoutes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.