Skip to content

roblesoft/topics

Repository files navigation

Topics project

Endpoints

Users

Register

Register a user with username and password.

POST /api/v1/users/register

Request body

{
	"username":  "string",
	"password":  "string"
}

Responses

{
	"message": "registration success"
}

Login

Login user with username and password.

POST /api/v1/users/login

Request body

{
	"username":  "string",
	"password":  "string"
}

Responses

{
	"token": "string"
}

Messages

User messages

Send a message to specific user with the username param or your can read your message inbox if the username in the param is yours.

Websocket /api/v1/users/:username/messages

Message body

{
	"content": "string"
}

Responses

{
	"content": "string",
	"username": "string"
}

Channels

Channel

You can Subscribe to a channel with a specific name in the channel param, use the command field in the message body with this options for a specific command:

  • 0 = Subscribe
  • 1 = Unsubscribe
  • 2 = Send message

Websocket /api/v1/channels/:channel

Message body

{
	"command": 0,
	"content": "string"
}

Responses

{
	"content": "string",
	"channel": "string"
}

Tables

users
id uint
username string
password string
CreatedAt datetime
UpdatedAt datetime
Messages
content string
channel string
username string
command int
error

Run project locally

Run project with docker compose

make local.run

Stop all containers

make local.run

Build project

make local.build

Run Tests

make local.test

DEPENDENCIES

  • Gorilla
  • GORM
  • Golang-JWT
  • Bcrypt
  • Rabbitmq/amqp091-go
  • Go-redis/redis/v7

TASK LIST

User resources

  • Gorm installation
  • User model
  • Registration Endpoint
  • JWT handler
  • Login endpoint

Websockets

  • gorilla installation
  • message model
  • message creation endpoint

User messages

  • websocket index endpoint
  • message queue

Channels

  • Users channels

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published