ribice / twisk Goto Github PK
View Code? Open in Web Editor NEWGolang RPC starter kit with Twirp
Home Page: https://www.ribice.ba/twisk/
License: MIT License
Golang RPC starter kit with Twirp
Home Page: https://www.ribice.ba/twisk/
License: MIT License
Hello,
I am interested in Twirp for a fairly conventional RPC system and this starter kit seems perfect. I want to use the provided Postgres server to get up and running quick, but after changing the db string where instructed I get this for the ouput of step 3:
โ migration git:(master) โ go run main.go
2019/08/09 15:53:54 ERROR #23505 duplicate key value violates unique constraint "roles_pkey" (addr="52.18.106.191:5432")
exit status 1
Is it possible to get this repaired upstream? I am not that familiar with Postgres and want to hit the ground running.
Where I can write my cookies to browser ?
func (s *Service) Auth(c context.Context, req *iam.AuthReq) (*iam.AuthResp, error) {
if err := req.Validate(); err != nil {
return nil, err
}
dbCtx := s.db.WithContext(c)
usr, err := s.udb.FindByAuth(dbCtx, req.Auth)
if err != nil {
return nil, invalidUserPW
}
if !s.sec.MatchesHash(usr.Password, req.Password) {
return nil, invalidUserPW
}
token, err := s.tg.GenerateToken(&guidecentury.AuthUser{
ID: usr.ID,
TenantID: usr.TenantID,
Username: usr.Username,
Email: usr.Email,
Role: guidecentury.AccessRole(usr.RoleID),
})
if err != nil {
return nil, err
}
uToken := xid.New().String()
usr.UpdateLoginDetails(uToken)
if err = s.udb.UpdateLastLogin(dbCtx, usr); err != nil {
return nil, err
}
// Todo Write my cookies to browsers?
return &iam.AuthResp{
Token: token,
RefreshToken: uToken,
}, nil
}
And how I write my cookies?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.