import http from 'http' ; export const initPlugin = async ( ) => http . createServer ( handler ) ; const sendResponse = ( response , data ) => { response . statusCode = 200 ; response . setHeader ( 'Content-Type' , 'application/json' ) ; response . end ( JSON . stringify ( data , null , 4 ) ) ; } ; const handler = ( request , response ) => { if ( request . method === 'POST' ) { return sendResponse ( response , { id : 'wowzeronza' , name : 'ET-69' , createdDate : '2021-06-01T17:29:51.092Z' , } ) ; } if ( request . method === 'PATCH' ) { return sendResponse ( response , { id : 'wowzeronza' , name : 'ET-69' , modifiedDate : '2021-06-01T17:29:51.092Z' , } ) ; } response . statusCode = 400 ; response . setHeader ( 'Content-Type' , 'application/json' ) ; response . end ( 'Not supported http method to request swimlane simulator' ) ; } ;