Skip to content
项目

dstotijn/golang-nextjs-portable

在 GitHub 查看

关于

Go program with embedded Next.js app.

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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.18
  • Yarn

Note: While the embed package was added in Go 1.16, the all: prefix of the embed directive was added in 1.18. We use all: in this project because Next.js static exports contain files and direcories with underscore prefixes.

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 nextjs
$ yarn install
$ yarn run export
$ cd ..
$ go build .

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

探索相关项目

加载中…