Documentation ¶
Index ¶
- func CreateBookmark(w http.ResponseWriter, r *http.Request)
- func DeleteBookmark(w http.ResponseWriter, r *http.Request)
- func GetBookmarkByID(w http.ResponseWriter, r *http.Request)
- func GetBookmarks(w http.ResponseWriter, r *http.Request)
- func GetBookmarksByUser(w http.ResponseWriter, r *http.Request)
- func Login(w http.ResponseWriter, r *http.Request)
- func Register(w http.ResponseWriter, r *http.Request)
- func UpdateBookmark(w http.ResponseWriter, r *http.Request)
- type AuthUserModel
- type AuthUserResource
- type BookmarkResource
- type BookmarksResource
- type DataStore
- type UserModel
- type UserResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBookmark ¶
func CreateBookmark(w http.ResponseWriter, r *http.Request)
CreateBookmark insert a new Bookmark. Handler for HTTP Post - "/bookmarks
func DeleteBookmark ¶
func DeleteBookmark(w http.ResponseWriter, r *http.Request)
DeleteBookmark deletes an existing Bookmark document Handler for HTTP Delete - "/Bookmarks/{id}"
func GetBookmarkByID ¶
func GetBookmarkByID(w http.ResponseWriter, r *http.Request)
GetBookmarkByID returns a single bookmark document by id Handler for HTTP Get - "/Bookmarks/{id}"
func GetBookmarks ¶
func GetBookmarks(w http.ResponseWriter, r *http.Request)
GetBookmarks returns all Bookmark documents Handler for HTTP Get - "/Bookmarks"
func GetBookmarksByUser ¶
func GetBookmarksByUser(w http.ResponseWriter, r *http.Request)
GetBookmarksByUser returns all Bookmarks created by a User Handler for HTTP Get - "/Bookmarks/users/{id}"
func Login ¶
func Login(w http.ResponseWriter, r *http.Request)
Login authenticates the HTTP request with username and apssword Handler for HTTP Post - "/users/login"
func Register ¶
func Register(w http.ResponseWriter, r *http.Request)
Register add a new User document Handler for HTTP Post - "/users/register"
func UpdateBookmark ¶
func UpdateBookmark(w http.ResponseWriter, r *http.Request)
UpdateBookmark update an existing Bookmark document Handler for HTTP Put - "/Bookmarks/{id}"
Types ¶
type AuthUserModel ¶
AuthUserModel for authorized user with access token
type AuthUserResource ¶
type AuthUserResource struct {
Data AuthUserModel `json:"data"`
}
AuthUserResource Response for authorized user Post - /user/login
type BookmarkResource ¶
BookmarkResource For Post/Put - /bookmarks For Get - /bookmarks/id
type BookmarksResource ¶
BookmarksResource for Get - /bookmarks
type DataStore ¶
type DataStore struct {
MongoSession *mgo.Session
}
DataStore for MongoDB
func NewDataStore ¶
func NewDataStore() *DataStore
NewDataStore creates a new DataStore object to be used for each HTTP request.
func (*DataStore) Close ¶
func (ds *DataStore) Close()
Close closes a mgo.Session value. Used to add defer statements for closing the copied session.
func (*DataStore) Collection ¶
Collection returns mgo.collection for the given name
type UserModel ¶
type UserModel struct { FirstName string `json:"firstname"` LastName string `json:"lastname"` Email string `json:"email"` Password string `json:"password"` }
UserModel reperesents a user
type UserResource ¶
type UserResource struct {
Data UserModel `json:"data"`
}
UserResource For Post - /user/register