Skip to content

Commit 40c81dd

Browse files
committed
Add docs/, a starter script, update instructions
1 parent ab8015f commit 40c81dd

File tree

6 files changed

+64
-6
lines changed

6 files changed

+64
-6
lines changed
File renamed without changes.

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ A Go chat app
33

44
## Running the App
55

6+
You can run the app directly on your machine if you have Postgres and RabbitMQ.
7+
8+
Otherwise, you can run the containerized version with:
9+
610
Clone this repo:
711

812
```shell
913
git clone [email protected]:robwillup/gochatty.git
1014
cd gochatty
1115
```
1216

13-
Build and run the `podman-compose` file:
17+
Run the following commands:
1418

1519
```shell
16-
podman-compose -f podman-compose.yml build
17-
18-
podman-compose -f podman-compose.yml up -d
20+
chmod +x scripts/run.sh
21+
./script/run.sh
1922
```

docs/requirements.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Go Challenge - Browser-based chat app
2+
3+
## Description
4+
5+
This project is designed to test your `knowledge of backend web technologies`, specifically in `Go` and assess your
6+
ability to create backend products with `attention to detail`, `standards`, and `reusability`.
7+
8+
## Assignment
9+
10+
The goal of this exercise is to create a simple browser-based chat application using Go.
11+
12+
This application should allow several users to talk in a chatroom and also to get stock quotes from an API using a
13+
specific command.
14+
15+
## Mandatory Features
16+
17+
* Allow registered users to log in and talk to other users in a chatroom.
18+
* Allow users to post messages as commands into the chatroom with the following format **/stock=stock_code**.
19+
* Create a **decoupled** bot that will call an API using the stock_code as a parameter
20+
* (https://stooq.com/q/l/?s=aapl.us&f=sd2t2ohlcv&h&e=csv) here *aapl.us* is the stock_code.
21+
* The bot should parse the received CSV file and then it should send a message back into the chatroom using a message
22+
broker like RabbitMQ. The message will be a stock quote using the following format:
23+
"APPL.US quote is $93.42 per share". The post owner will be the bot.
24+
* Have the chat message ordered by their timestamps and show only the last 50 messages.
25+
* Unit tests
26+
27+
## Bonus (Optional)
28+
29+
* Have more than one chatroom.
30+
* Handle messages that are not understood or any exceptions raised within the bot.
31+
32+
## Considerations
33+
34+
* We will open two browser windows and log in with 2 different users to test the functionalities.
35+
* The stock command won't be saved on the database as a post.
36+
* The project is totally focused on the backend; please, have the frontend as simple as you can.
37+
* Keep confidential information secure.
38+
* Pay attention if your chat is consuming too many resources.
39+
* Keep your code versioned with Git locally.
40+
* Feel free to use small helper libraries.
41+
42+
## Deliverables
43+
44+
When you finish the assignment upload your project to your GitHub and share the repo link with your initial contact
45+
via email.
46+
Indicate which, if any, of the bonus tasks you completed.
47+
48+
If you didn't manage to finish everything, please tell us which parts you completed.
49+

internal/auth/jwt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/golang-jwt/jwt/v5"
77
)
88

9-
var jwtKey = []byte("secret_key") // TODO: Use a secure value.
9+
var jwtKey = []byte("secret_key") // TODO: Use real key from vault/env vars.
1010

1111
func GenerateJWT(username string) (string, error) {
1212
claims := &jwt.RegisteredClaims{

podman-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323
server:
2424
build:
2525
context: .
26-
dockerfile: Dockerfile.server
26+
dockerfile: Containerfile
2727
restart: always
2828
environment:
2929
DATABASE_URL: postgres://gochattyuser:gochattypass@db:5432/gochattydb?sslmode=disable

scripts/run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
podman-compose -f podman-compose.yml build
4+
podman-compose -f podman-compose.yml up -d
5+
6+
open frontend/index.html

0 commit comments

Comments
 (0)