Skip to content

jerome-bienaime/backstack

Repository files navigation

BACKSTACK

Go stack to start on.

E2E Go

Requirements

Docker

docker build -t web .
docker-compose up # server at :8080

Install

make install

.env

cp .example.env .dev.env

Usage

ENV=DEV go run --tags="fts5" main.go . # start server on :8080

Enable SSL

Enable SSL by setting HTTP_SSL to 1 in .*.env

Example with .dev.env

# .dev.env
HTTP_SSL=1

You will need to create a certificate

Create certificate locally (with openssl)

# interactive
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365

# non-interactive and 10 years expiration
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"

Known issues:

cp key.unencrypted.pem key.pem

Build

ENV=DEV go build --tags="fts5" . # build ./web executable
./web # launch server at :8080

Reset database

Test

make re-test # delete test database, & reseed

Dev

make re-dev # reset dev database, & reseed

Tests

Unit && Integration

Github actions uses go.yml file to execute unit and integration tests.

make # make clean && make install
ENV=TEST go test -tags fts5 -timeout 30s -v ./...

E2E

Cypress is used to do E2E tests.

You will need NodeJS and a package manager: pnpm or npm or yarn installed on your computer. Github actions uses e2e.yml file to execute E2E tests. The tests are located under cypress directory.

Cypress (application)

In a terminal run the server:

ENV=TEST go run --tags="fts5" main.go .

In another terminal run the application

pnpm cypress open 
# or
npx cypress open
# or
yarn cypress open

Cypress (cli)

The CLI version does not need you to launch server, however you will need to build the go binary. See build section

Once you have build go binary, launch in terminal

pnpm run ci 
# or
npm run ci
# or
yarn ci

LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published