-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
80 lines (61 loc) · 1.21 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
To restart docker:
```
docker compose down
docker compose up -d
```
To login into psql database after running docker
```
docker exec -it lenslocked-db-1 /usr/bin/psql -U baloo -d lenslocked
```
To start the Go Server with file watching:
```
modd
```
To start the dev server for frontend development
```
cd frontend
npm run dev
```
and then visit `localhost:5173`
Above command starts the Vite server. When the vite server is running, the frontend is served directly from Vite but all request made to the `/api` endpoint is proxied to the Go backend
by Vite.
To build the frontend to serve it directly from the Go server
```
npm run build
```
and then visit `localhost:3000`
## Migrations
```
cd migrations
goose create galleries sql
```
```
goose fix # converts to 00004_galleries.sql instead of timestamp
```
In the migrations add:
```
-- +goose Up
-- +goose StatementBegin
CREATE TABLE galleries (
id SERIAL PRIMARY KEY,
user_id INT REFERENCES users (id),
title TEXT
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE galleries;
-- +goose StatementEnd
```
```
cd ..
code models/galleries.go
```
```
package models
type Galleries struct {
ID int
UserID int
Title string
}
```