Minimal boilerplate with a golang server using Fiber and ViteJS for static pages
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Antonio De Lucreziis 4653793eea Fixed HMR 2 years ago
_frontend Fixed HMR 2 years ago
config Small refactor, added ViteJS debug logging and server.js for serving dynamic routes in dev mode 2 years ago
database Initial commit 2 years ago
routes Initial commit 2 years ago
.gitignore Added a routes.js file for writing routes and entry html files only once 2 years ago
README.md Added a routes.js file for writing routes and entry html files only once 2 years ago
go.mod Initial commit 2 years ago
go.sum Initial commit 2 years ago
main.go Small refactor, added ViteJS debug logging and server.js for serving dynamic routes in dev mode 2 years ago

README.md

Go Vite Kit

Minimal boilerplate project for a Golang server using Fiber and ViteJS for static pages

Features

Architecture

  • _frontend/

    This is a Vite project for building all the static pages used by this app.

    The routes.js (this is used both from server.js for serving and from vite.config.js for building) file contains a mapping from express route patterns to entry html files, this is useful for rendering the same page for multiple urls in development mode.

  • database/

    Module with a Database interface and two implementation: memDB is an in-memory database for testing purposes. sqliteDB is a wrapper for working with an SQLite database.

  • routes/

    Various functions for configuring all the server routes.

Usage

First install the required npm packages

$ cd _frontend
_frontend/ $ npm install

Development

# Development
$ MODE=dev go run -v .

# Development with watcher
$ fd -e go | MODE=dev entr -r go run -v .

Production

First build the _frontend/dist folder using

$ cd _frontend
$ npm run build

and then

# Production
$ go run -v .