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