-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (25 loc) · 876 Bytes
/
Copy pathserver.js
File metadata and controls
29 lines (25 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This script starts the mock backend.
// Once the backend is running, its mocking interface can be accessed via HTTP.
// E.g. call http://localhost:3000/endpoints
//
// ng-apimock configuration file, see link for more information:
// https://ngapimock.org/docs/
const devInterface = require('@ng-apimock/dev-interface');
const apimock = require('@ng-apimock/core');
const express = require('express');
const server = express();
const apiRoute = '/endpoints';
apimock.processor.process({
src: 'e2e/server/mocks',
patterns: {
mocks: '**/*.mock.json',
presets: '**/*.preset.json',
},
watch: true,
});
server.set('port', 3000);
server.use(apimock.middleware);
server.use(apiRoute, express.static(devInterface));
server.listen(server.get('port'), () => {
console.info('@ng-apimock UI is available on http://localhost:' + server.get('port') + apiRoute);
});