import express from 'express' ; import mockApiMiddleware from './mock-api-middleware' ; const app = express ( ) ; const port = process . argv [ 2 ] || 3001 ; app . use ( ( _ , res , next ) => { res . header ( 'Access-Control-Allow-Origin' , '*' ) ; res . header ( 'Access-Control-Allow-Headers' , 'X-Requested-With, content-type' ) ; res . header ( 'Access-Control-Allow-Methods' , 'GET, POST, OPTIONS, PUT, DELETE' ) ; next ( ) ; } ) ; mockApiMiddleware ( app as any ) ; app . listen ( port , ( ) => { console . log ( 'Server listening at http://localhost:' + port ) ; } ) ;