You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
731 B

package Api
import (
"log"
"github.com/gorilla/mux"
)
func InitApiEndpoints() *mux.Router {
var (
router *mux.Router
)
log.Println("Initializing API routes...")
router = mux.NewRouter()
// Define routes for posts api
router.HandleFunc("/post", getPosts).Methods("GET")
router.HandleFunc("/frontPagePosts", getFrontPagePosts).Methods("GET")
router.HandleFunc("/post", createPost).Methods("POST")
router.HandleFunc("/post/{postID}", createPost).Methods("GET")
router.HandleFunc("/post/{postID}", updatePost).Methods("PUT")
router.HandleFunc("/post/{postID}", deletePost).Methods("DELETE")
//router.PathPrefix("/").Handler(http.StripPrefix("/images/", http.FileServer(http.Dir("./uploads"))))
return router
}