import { Router } from 'express' ; import { DeviceStore } from '../store/deviceStore' ; export default function ( deviceStore ) { let api = Router ( ) ; api . get ( '/' , function ( req , res , next ) { res . json ( deviceStore . getListOfItems ( ) ) ; } ) ; api . get ( '/start' , function ( req , res , next ) { deviceStore . startAll ( ) ; res . json ( deviceStore . getListOfItems ( ) ) ; } ) ; api . get ( '/stop' , function ( req , res , next ) { deviceStore . stopAll ( ) ; res . json ( deviceStore . getListOfItems ( ) ) ; } ) ; api . get ( '/reset' , function ( req , res , next ) { deviceStore . reset ( ) ; res . json ( deviceStore . getListOfItems ( ) ) ; } ) ; return api ; }