Skip to content

A WIP attempt to follow John Calhoun's Web Dev With Go course with a React SPA front-end instead of Go Templates. Course here: https://www.usegolang.com/

Notifications You must be signed in to change notification settings

canrozanes/lenslocked-react

Repository files navigation

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
}
```

About

A WIP attempt to follow John Calhoun's Web Dev With Go course with a React SPA front-end instead of Go Templates. Course here: https://www.usegolang.com/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published