} catch (ResourceNotFoundException $e) { $app->response()->status(404); } catch (ResourceNotFoundException $e) { $app->response()->status(400); $app->response()->header('X-Status-Reason', $e->getMessage()); } }); $app->post('/addmember(/)', 'authenticate', function () use($app) { try { $us = new UsersService(); $request = $app->request(); $mediaType = $request->getMediaType(); $body = $request->getBody(); $input = json_decode($body); $u = (string) $input->userid; $id = $us->createUsers($input, $u); if ($id) { echo json_encode($id); } else { throw new ResourceNotFoundException(); } } catch (ResourceNotFoundException $e) { $app->response()->status(404); } catch (ResourceNotFoundException $e) { $app->response()->status(400); $app->response()->header('X-Status-Reason', $e->getMessage()); } }); $app->post('/editmember/:id(/)', 'authenticate', function ($id) use($app) { try { $us = new UsersService();
} } else { throw new Exception('No data for Update'); } } catch (Exception $e) { http_response_code(500); echo $e->getMessage(); //throw new Exception($e->getMessage()); } break; case 'POST': try { if ($input) { if (empty($resuest[0])) { $u = new Users(); $u->{$rs} = $sv->createUsers($u, $user); echo json_encode($rs); // } else if($request[0] == ''){ // $rs = $sv->function($u,$user); // echo json_encode($rs); } } else { throw new Exception('No data for Insert'); } } catch (Exception $e) { http_response_code(500); // throw new Exception($e->getMessage()); echo $e->getMessage(); } break; case 'GET':