Skip to content

Instantly share code, notes, and snippets.

@NSLog0
Last active September 7, 2017 11:14
Show Gist options
  • Save NSLog0/e8395b2fa2ce78e6dc04d69aeb58d9ac to your computer and use it in GitHub Desktop.
Save NSLog0/e8395b2fa2ce78e6dc04d69aeb58d9ac to your computer and use it in GitHub Desktop.
api naming article
def index
# get all data and connect with database(Back end logic)
# retun html file to client
render 'index'
end
def new
# retun html file to client
render 'new'
end
def show
# sometime we can say it's a find by id
# retun html file to client
render 'show'
end
def edit
# retun html file to client
render 'edit'
end
def create
# create data and connect with database(Back end logic)
end
def update
# update data and connect with database(Back end logic)
end
def delete
# delete data and connect with database(Back end logic)
end
public class Dogs {
private String name = "";
public void say() {
System.out.print(this.name + " Woof!! Woof!!");
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
// let say we have main class
Dogs d = new Dogs
d.setName("Bob");
d.say(); // Bob Woof!! Woof!!
|Method| |URI| |Controller and method|
GET /users users#index
POST /users users#create
GET /users/new users#new
GET /users/:id/edit users#edit
GET /users/:id users#show
PATCH /users/:id users#update
PUT /users/:id users#update
DELETE /users/:id users#destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment