예제 #1
0
파일: file_based.go 프로젝트: jonasfj/leaps
/*
RegisterHandlers - Register an endpoint for obtaining a list of available files.
*/
func (f *File) RegisterHandlers(register register.PubPrivEndpointRegister) error {
	if len(f.config.FileConfig.Path) > 0 {
		return register.RegisterPublic(
			f.config.FileConfig.Path,
			"Get a list of files available for editing",
			f.servePaths,
		)
	}
	return nil
}
예제 #2
0
파일: http_based.go 프로젝트: jonasfj/leaps
/*
RegisterHandlers - Register endpoints for adding new auth tokens.
*/
func (h *HTTP) RegisterHandlers(register register.PubPrivEndpointRegister) error {
	if err := register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "create"),
		`Generate an authentication token for creating a new document, POST: {"key_value":"<user_id>"}`,
		h.createHandler,
	); err != nil {
		return err
	}
	if err := register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "read"),
		`Generate an authentication token for joining an existing document in read only mode, POST: {"key_value":"<document_id>"}`,
		h.readOnlyHandler,
	); err != nil {
		return err
	}
	return register.RegisterPrivate(
		path.Join(h.config.HTTPConfig.Path, "join"),
		`Generate an authentication token for joining an existing document, POST: {"key_value":"<document_id>"}`,
		h.joinHandler,
	)
}