Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raezil/prototext

CRUD grpc application in Golang
https://github.com/raezil/prototext

backend crud-application golang grpc grpc-gateway grpc-go kubernetes prisma-go protobuf

Last synced: 20 days ago
JSON representation

CRUD grpc application in Golang

Awesome Lists containing this project

README

        

# ProtoText
Published on Medium
https://medium.com/@kamilmociszko/build-grpc-crud-app-in-golang-using-prisma-jwt-grpc-gateway-and-kubernetes-a11c3953a880

## Kubernetes

### Run Docker
```
docker build -t app:latest .
docker login
docker push $docker_username/app:latest
```

- Apply kubectl
```
minikube start
cd k8s
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
```
- Port Foward
```
kubectl port-forward service/app-service 8080:8080 -n default
```
- Check pods
```
kubectl get pods -n default
kubectl describe pod $NAME -n default
```

## Sample curl requests
Register:
```
curl --http2 -X POST http://localhost:8080/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "password123",
"name": "John",
"surname": "Doe",
"age": 30
}'
```
Log in
```
curl --http2 -X POST http://localhost:8080/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "password123"
}'

```

Protected request
```
curl --http2 -X POST http://localhost:8080/v1/auth/protected -H "Content-Type: application/json" -H "Authorization: $TOKEN" -d '{
"text": "This is a protected request."
}'
```