Go program with embedded Next.js app.

golang-nextjs-portable

golang-nextjs-portable is a small Go program to showcase the embed package for bundling a static HTML export of a Next.js app.

👉 Read the companion article that walks through this project.

Requirements

  • Go 1.16
  • Yarn

Installing

Clone or download the repository:

$ git clone [email protected]:dstotijn/golang-nextjs-portable.git

Usage

From the repository root directory, generate the static HTML export of the Next.js app, and build the Go binary:

$ cd client
$ yarn install
$ yarn run export
$ cd ..
$ go build main.go

Then run the binary:

$ ./golang-nextjs-portable

2021/04/27 14:55:38 Starting HTTP server at http://localhost:8080 ...

License

MIT


© 2021 David Stotijn — Twitter, Email, Homepage

Owner
David Stotijn
Software Engineer
David Stotijn
Similar Resources

This is a very simple web-app which simply always returns HTTP status code 200

Responder This is a very simple web-app which simply always returns HTTP status code 200. It will also wait for an amount of time which can be set in

Dec 14, 2021

Tutorial: Deploying a basic Gin app on Jekyo

Tutorial: Deploying a basic Gin app on Jekyo Demo app here Prerequisites Make sure you have NodeJS, npm and git installed. If it's your first time usi

Nov 1, 2021

A simple app that reads NBMiner status REST API data and sends it to InfluxDB

NBMiner Reporter A simple Go app that reads NBMiner status REST API data and sends it to InfluxDB. Usage Using the reporter is quite easy, specially i

Feb 8, 2022

GoAdmin is a toolkit to help you build a data visualization admin panel for your golang app.

GoAdmin is a toolkit to help you build a data visualization admin panel for your golang app.

the missing golang data admin panel builder tool. Documentation | 中文文档 | 中文介绍 | DEMO | 中文DEMO | Twitter | Forum Inspired by laravel-admin Preface GoAd

Nov 25, 2021

A barebones Go app, which can easily be deployed to Heroku

go-getting-started A barebones Go app, which can easily be deployed to Heroku. This application supports the Getting Started with Go on Heroku article

Nov 29, 2021

A web app that displays a new random famous quote every day (UTC timezone) and allows people to like/unlike the quote

Intro A web app that displays a new random famous quote every day (UTC timezone) and allows people to like/unlike the quote. The app display the curre

Dec 8, 2021

Go-get-gin - Simple golang app deployed on gcp

go-get-gin a simple golang gin app to be deployed on gcp Getting started make su

Jan 12, 2022

A todo app written in Golang, MongoDB, and React.

A todo app written in Golang, MongoDB, and React.

A todo app written in Golang, MongoDB, and React.

Jun 5, 2022

A sample url shortener app to test Keploy integration capabilities

A sample url shortener app to test Keploy integration capabilities

Example URL Shortener A sample url shortener app to test Keploy integration capabilities Installation git clone https://github.com/keploy/example-url-

Oct 22, 2022
Comments
  • Fix #2 : page refresh in subdirs

    Fix #2 : page refresh in subdirs

    In the current version, when you refresh the page in the /foo or /foo/bar pages, it doesn't work as expected.

    This fix change the generation of html files to remove that issue.

    This is the new generated file structure for the ui :

    nextjs/dist/
    ├── 404
    │   └── index.html
    ├── foo
    │   ├── bar
    │   │   └── index.html
    │   └── index.html
    ├── index.html
    
  • Page 404 on refresh

    Page 404 on refresh

    Hi, Thanks for the repo and the article.

    After we export and run the server with files from embed.FS, when I click on the links it does work but when I go to http://localhost:8080/foo/bar and refresh I get 404 page not found.

  • readme update

    readme update

    first off - fantastic article! It was shared at work - Loblaw Digital - a lot of devs also enjoyed it!

    So I ran through this project and just had 1 hiccup

    When you say this...

    Then run the binary:
    $ ./golang-nextjs-portable
    

    should be

    Then run the binary:
    $ ./main
    

    right? I'm new Go and the former failed for me but the later works - you build the main.go file into an executable main file

Colonies is a generic framework for implementing next-generation distributed applications and systems
Colonies is a generic framework for implementing next-generation distributed applications and systems

Colonies is a generic framework for implementing next-generation distributed applications and systems. It can be used as a building block for grid computing or edge computing, e.g. implement a meta operating system or cloud-of-cloud platform that combines many execution environments into a new virtual computing environment that can be controlled using an single unified API.

Nov 14, 2022
記帳-PWA-web-app (Bookkeeping-PWA-web-app)
記帳-PWA-web-app (Bookkeeping-PWA-web-app)

GoKeep (bookkeeping web app) 記帳-PWA-web-app (Bookkeeping-PWA-web-app) demo link : https://bookkepping.herokuapp.com/ 測試用帳密 : tester002 , tester002 (亦可

Jan 31, 2022
A program for creating a report on graphs from graphana
A program for creating a report on graphs from graphana

Программа для создания отчёта по графикам из графаны. Generate doc report from Grafana dashboard. Вам нужно перед первым запуском сконфигурировать tsc

Nov 2, 2021
Project E-Commerce Alta Store Program Immersive Back End Batch 4
Project E-Commerce Alta Store Program Immersive Back End Batch 4

Project E-Commerce Project E-Commerce Alta Store Program Immersive Back End Batch 4 Explore the docs » Daftar Isi About The Project Built With ERD Con

Dec 30, 2021
GoatCounter is an open source web analytics platform available as a hosted service or self-hosted app

GoatCounter is an open source web analytics platform available as a hosted service (free for non-commercial use) or self-hosted app. It aims to offer easy to use and meaningful privacy-friendly web analytics as an alternative to Google Analytics or Matomo.

Dec 29, 2022
listmonk is a standalone high performance, self-hosted newsletter and mailing list manager with a modern dashboard. Single binary app.
listmonk is a standalone high performance, self-hosted newsletter and mailing list manager with a modern dashboard. Single binary app.

listmonk is a standalone, self-hosted, newsletter and mailing list manager. It is fast, feature-rich, and packed into a single binary. It uses a PostgreSQL database as its data store.

Jan 1, 2023
Tiny to-do list web app written in Go

Simple Lists Simple Lists is a tiny to-do list web app. It's written in Go in an old-school way with no JavaScript, plain old HTTP GET and POST, and a

Oct 19, 2022
golang-react-app
golang-react-app

- Estructura planteada: api ( Aplicación backend desarrollada en GOLANG ) controllers main.go product.go database connection.go models price.go produc

Nov 27, 2022
App Twittor
App Twittor

Documentacion App Esta app utiliza el siguiente stack: Github, Heroku, Postman, MongoDB, Golang Crear un Cluster de Base de Datos en la Nube con Mongo

Jun 20, 2022
Simple web app using Go and Gin framework

go-gin-app Simple web app using Go and Gin framework Golang 과 Gin 프레임워크를 사용한 간단한 웹 앱 How to get Started Install Gin and have Go installed on your syst

Oct 18, 2021