Skip to content

A full stack web application using net/http, database/sql and html/template

License

Notifications You must be signed in to change notification settings

ferdiebergado/fullstack-go

Repository files navigation

fullstack-go

A full stack web application using net/http, database/sql and html/template.

Requirements

  1. Go version 1.22 or higher
  2. Docker or Podman
  3. Task
  4. Esbuild

Usage

Step 1

Install development tools.

The following tools are used in this project:

  • migrate for database migrations
  • sqlc for sql code generation
  • air for live reloading
  • and more

Run the task below to install them:

task tools

Step 2

Copy .env.example to .env.

cp .env.example .env

Step 3

Set the environment variables in .env according to your setup.

If using podman, change CONTAINER variable to podman.

Step 4

Start the database.

task db

Step 5

Run database migrations.

task migrate

Step 6

Bundle the css files.

Open a new terminal and run the css:watch task.

task css:watch

Step 7

Bundle the javascript files.

Open a new terminal and run the js:watch task.

task js:watch

Step 7

Start the application.

task dev

Step 8

Interact with the application.

Open your browser on localhost:8888.

An api is also available at the /api endpoint.

Running Tests

First, setup the test environment:

task setup_test

You just need to run this once per terminal session.

Then, run the tests:

task test

About

A full stack web application using net/http, database/sql and html/template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published