func (c *PostController) Delete(id int64) {
	c.Log().Infof("Deleting post, ID: %v", id)
	if err := models.DeletePost(id); err != nil {
		c.Log().Errorf("Post ID %v, %v", id, err)
		c.Reply().NotFound().JSON(aah.Data{
			"error": err.Error(),
		})
		return
	}
	c.Reply().NoContent()
}
Delete method deletes the post of given post ID.
package controllers
import (
	"fmt"
	"aahframe.work"
	"aahframework.org/examples/rest-api/app/models"
)
type PostController struct {
	*aah.Context
}
func (c *PostController) List() {
	posts := models.AllPosts()
	c.Log().Infof("%v posts found", len(posts))
	c.Reply().JSON(aah.Data{
		"posts": posts,
	})
}
func (c *PostController) Create(post *models.Post) {
	c.Log().Infof("Post Info: %+v", *post)
	id := models.CreatePost(post)
	newResourceURL := fmt.Sprintf("%s:%v", c.Req.Scheme, c.RouteURL("retrieve_post", id))
	c.Reply().Created().
		Header("Location", newResourceURL).
		JSON(aah.Data{
			"id": id,
		})
}
func (c *PostController) Retrieve(id int64) {
	c.Log().Infof("Retrieving post, ID: %v", id)
	post, err := models.GetPost(id)
	if err != nil {
		c.Log().Errorf("Post ID %v, %v", id, err)
		c.Reply().NotFound().JSON(aah.Data{
			"error": err.Error(),
		})
		return
	}
	c.Reply().JSON(models.ToPostAlias(post))
}
func (c *PostController) Update(id int64, post *models.Post) {
	c.Log().Infof("Updating post: %v", id)
	if post.ID == 0 {
		post.ID = id
	}
	if err := models.UpdatePost(post); err != nil {
		c.Log().Errorf("Post ID %v, %v", id, err)
		c.Reply().NotFound().JSON(aah.Data{
			"error": err.Error(),
		})
		return
	}
	c.Reply().NoContent()
}