/twigo

Repository for studying purposes

Primary LanguageGoMIT LicenseMIT

Go version Build Status Go Report Card GolangCI Report card codecov.io Swagger License

Twigo APP

Install

  1. Set your ENV

     # Postgres
     DB_HOST=db
     DB_DRIVER=postgres
     DB_USER=postgres
     DB_PASSWORD=postgres
     DB_NAME=postgres
     DB_SSL_MODE=disable
     
     # gRPC server
     SERVER_HOST=server
     SERVER_PORT=8081
     
     # Rest gateway
     GATEWAY_HOST=
     GATEWAY_PORT=8080
     
     # JWT secret key
     JWT_SECRET=jwtSecretKey
    
  2. docker-compose -f deployments/docker-compose.yml up or make dockerize

  3. Endpoints hosted on http://GATEWAY_HOST:GATEWAY_PORT/

  4. Open Swagger

Endpoints

POST /register - create new account with specified nick(unique in app), email, and password

Payload: 
	username - some user name
	email - user email address
	password - some password 

Result: 
	id - primary key
	username - username which you specified in payload 
	email   - user email address which you specified in payload 

POST /login - accept email and password and return token, uses JWT

Payload:
	email - user email address
	password - some password 

Result:
	token - jwt token

POST /subscribe - add account with login to your subscription list, you start seeing his tweets in your feeds

Payload: 
	nickname - nick name for account for which you want to subscribe 

POST /tweets - create a tweet, account id should be found from JWT

Payload: 
	message - some tweet message

Result:
	id - message primary key 
	message - tweet message

GET /tweets - return all tweets from your subscriptions

Result:
	tweets -  all tweets from your subscriptions