user-srv

command module
v0.0.0-...-6287e07 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2018 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

User Server

A user service for storing accounts and simple auth.

Getting started

To run this example, make sure that you have Consul and MySQL running.

consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
Install package

To easily run this example, you can install this repository as a Go package using the following command in your terminal.

go get github.com/microhq/user-srv

If you run into problems installing the usr-srv package, make sure that you have git terminal prompts enabled.

env GIT_TERMINAL_PROMPT=1 go get github.com/microhq/user-srv
Run service

Run the service using the usr-srv binary installed in the previous step. Also, make sure that the $GOPATH/bin directory is listed on your environment $PATH.

user-srv --database_url="root:root@tcp(127.0.0.1:3306)/user"

The API

User server implements the following RPC Methods

Account

  • Create
  • Read
  • Update
  • Delete
  • Search
  • UpdatePassword
  • Login
  • Logout
  • ReadSession
Create
micro call go.micro.srv.user Account.Create '{"user":{"id": "ff3c06de-9e43-41c7-9bab-578f6b4ad32b", "username": "asim", "email": "asim@example.com"}, "password": "password1"}'
Read
micro call go.micro.srv.user Account.Read '{"id": "ff3c06de-9e43-41c7-9bab-578f6b4ad32b"}'
Update
micro call go.micro.srv.user Account.Update '{"user":{"id": "ff3c06de-9e43-41c7-9bab-578f6b4ad32b", "username": "asim", "email": "asim+update@example.com"}}'
Update Password
micro call go.micro.srv.user Account.UpdatePassword '{"userId": "ff3c06de-9e43-41c7-9bab-578f6b4ad32b", "oldPassword": "password1", "newPassword": "newpassword1", "confirmPassword": "newpassword1" }'
Delete
micro call go.micro.srv.user Account.Delete '{"id": "ff3c06de-9e43-41c7-9bab-578f6b4ad32b"}'
Login
micro call go.micro.srv.user Account.Login '{"username": "asim", "password": "password1"}'
Read Session
micro call go.micro.srv.user Account.ReadSession '{"sessionId": "sr7UEBmIMg5hYOgiljnhrd4XLsnalNewBV9KzpZ9aD8w37b3jRmEujGtKGcGlXPg1yYoSHR3RLy66ugglw0tofTNGm57NrNYUHsFxfwuGC6pvCn8BecB7aEF6UxTyVFq"}'
Logout
micro call go.micro.srv.user Account.Logout '{"sessionId": "sr7UEBmIMg5hYOgiljnhrd4XLsnalNewBV9KzpZ9aD8w37b3jRmEujGtKGcGlXPg1yYoSHR3RLy66ugglw0tofTNGm57NrNYUHsFxfwuGC6pvCn8BecB7aEF6UxTyVFq"}'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
proto
account
Package account is a generated protocol buffer package.
Package account is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL