Skip to content

Starter for combining Go and Preact in any web project.

Notifications You must be signed in to change notification settings

azer/go-preact-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-preact-starter

Starter for combining Go and Preact in any web project.

How It Works?

  • Renders Preact components on serverside using go-duktape
  • Unifies client-side and server-side routing on one JSON file.
  • Watches Go, JS, CSS files, compiles them automatically and refreshes your browser.
  • Uses Browserify, no configuration needed.
  • Supports server-side templating for HTML documents that wraps the application. So you can have multiple pages.
  • Locates all Go dependencies inside the project for security by giving you a convenient GOPATH setup.
  • Provides caching when development mode is disabled.

Install

Clone the repo and install the dependencies:

git clone [email protected]:azer/go-preact-starter.git hello-world
cd hello-world
make install # install dependencies needed
make develop # start developing! visit localhost:9000 to see your website!

Coding Notes

  • Create UI components under frontend/components
  • Define your routes on routes.json, point them to a valid component.
  • Run make go-get and make frontend-install to install new dependencies.
  • Edit .env file to choose different host/port for serving.

What's missing ?

  • API polyfill for backend
  • Could be nice to see backend errors on the browser.