Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const ioc_container = require('@ng-apimock/core/dist/ioc-container');
const helper = require('./helper');
const apimock = require('@ng-apimock/core');
const devInterface = require('@ng-apimock/dev-interface');
const app = express();
// Check parameter otherwise fall back to port 4000
app.set('port', process.env.PORT || 4000);
// Specify which mocks and presets to load
// - mocks should end with .mock.json
// - presets should end with .preset.json
apimock.processor.process({
src: './mockserver',
});
// Add additional logging to the mockServer so we can debug if certain calls ever happened
// NOTE: Enable to allow additional logging
app.use(morgan('dev'));
// Add form data parser so we can check deprecated request bodies
app.use(bodyParser.urlencoded({ extended: true }));
// Add API wide headers which are dictated by nginx
app.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'https://localhost:4202');
res.header(
'Access-Control-Allow-Methods',