Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isaquemicroservices/authentication
🔐 Microservice for user authentication built with golang and gRPC
https://github.com/isaquemicroservices/authentication
authentication ddd-architecture golang golang-application grpc microservice open-source postgresql
Last synced: 2 months ago
JSON representation
🔐 Microservice for user authentication built with golang and gRPC
- Host: GitHub
- URL: https://github.com/isaquemicroservices/authentication
- Owner: isaquemicroservices
- License: mit
- Created: 2022-01-11T14:26:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-30T15:01:30.000Z (over 2 years ago)
- Last Synced: 2024-11-16T03:41:57.483Z (3 months ago)
- Topics: authentication, ddd-architecture, golang, golang-application, grpc, microservice, open-source, postgresql
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 🔐 Microservice to authentication users using golang and grpc
Command to generate protobuf
```go
$ protoc -I . protos/auth/auth.proto --go_out=plugins=grpc:./application
```### Create folder for config.json file
```bat
$ sudo mkdir /etc/ms-auth
$ sudo touch /etc/ms-auth/config.json
$ sudo cp ./config.json /etc/ms-auth/config.json
$ sudo chmod 777 /etc/ms-auth/config.json
```
If you changed the config.json file, use the command at the bottom to update the config.json file on your computer
```bat
$ sudo cp ./config.json /etc/ms-auth/config.json
```### Command to run the test
```go
$ go test ./... --cover
```### Command to generate test files
```go
$ go test -coverprofile cover.out
$ go tool cover -html=cover.out -o cover.html
```### Create user table in PostgreSQL
```sql
CREATE TABLE public.t_users (
id serial4 NOT NULL,
"name" varchar(100) NOT NULL,
email varchar(100) NOT NULL,
passw varchar(100) NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NULL,
level_id int4 NOT NULL,
CONSTRAINT t_users_pkey PRIMARY KEY (id),
CONSTRAINT t_users_un UNIQUE (email),
CONSTRAINT t_users_fk FOREIGN KEY (level_id) REFERENCES public.t_users_level(id) ON DELETE CASCADE ON UPDATE CASCADE
);CREATE TABLE public.t_users_level (
id serial4 NOT NULL,
"name" varchar NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT t_users_level_pk PRIMARY KEY (id)
);
```