some code for handle get and post