-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dbe26cb
Showing
20 changed files
with
1,030 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/build | ||
.DS_Store | ||
.direnv/ | ||
.envrc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM golang:1.19 AS builder | ||
WORKDIR /app | ||
COPY . . | ||
RUN go mod download | ||
RUN CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static'" -o /myproject ./build/cmd/myproject | ||
FROM alpine | ||
COPY --from=builder /myproject / | ||
EXPOSE 8080 | ||
ENTRYPOINT [ "/myproject" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Pushup main website | ||
|
||
This is the main website for the Pushup project, including documentation. It | ||
is a Pushup app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>^if sectionDefined("title") { | ||
<text>^outputSection("title")</text> | ||
} ^else { | ||
<text>Pushup - page-oriented web framework for Go</text> | ||
}</title> | ||
<meta name="description" content="Pushup is a server-side page-oriented web application framework for Go."> | ||
<link rel="icon" href="/static/favicon.ico" type="image/x-icon" /> | ||
<link rel="stylesheet" href="/static/style.css" /> | ||
<script src="/static/htmx.min.js"></script> | ||
</head> | ||
<body> | ||
<nav> | ||
<ul> | ||
<li><a hx-boost="true" href="/">Pushup</a></li> | ||
<li><a hx-boost="true" href="/docs/">Documentation</a></li> | ||
<li><a href="https://github.com/adhocteam/pushup">GitHub</a></li> | ||
</ul> | ||
</nav> | ||
<main> | ||
^outputSection("contents") | ||
</main> | ||
<footer> | ||
<p> | ||
Copyright © 2022. | ||
Made with <a href="https://pushup.adhoc.dev/">Pushup</a>. | ||
Supported by | ||
<a class="adhoc" href="https://adhoc.team/"><img | ||
src="/static/adhoc-logo.png" | ||
alt="Ad Hoc logo" | ||
width="91" height="91"> Ad Hoc</a>. | ||
</p> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
^handler { | ||
doc := getParam(req, "doc") | ||
rawMarkdown := GetStaticContents("docs/" + doc + ".md") | ||
} | ||
|
||
^convertMarkdown(rawMarkdown) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<h1>Pushup documentation</h1> | ||
|
||
^{ | ||
type doc struct { | ||
name string | ||
url string | ||
} | ||
docs := []doc { | ||
{name: "Introduction to Pushup", url: "intro"}, | ||
{name: "Getting started", url: "getting-started"}, | ||
{name: "Syntax", url: "syntax"}, | ||
{name: "Guides", url: "guides"}, | ||
} | ||
} | ||
|
||
<ul> | ||
^for _, d := range docs { | ||
<li> | ||
<a hx-boost="true" href="^d.url">^d.name</a> | ||
</li> | ||
} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<header> | ||
<h1> | ||
<img | ||
width="91" height="49" | ||
src="/static/logo.png" | ||
alt="Pushup logo, a caret surrounded by left and right angle brackets ala HTML element"> | ||
Pushup web framework | ||
</h1> | ||
</header> | ||
|
||
<section> | ||
<p>A server-side, page-oriented web framework for the Go programming language.</p> | ||
|
||
<p>Pushup’s goal is to make it faster to develop and easier to maintain server-side web applications using Go.</p> | ||
|
||
<p>Pushup is <b>preview</b>, pre-release software in early-stage development. It is not yet suitable for production use. Expect breaking changes.</p> | ||
</section> | ||
|
||
<iframe width="560" height="315" src="https://www.youtube.com/embed/nkyiATkZ4Js" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
|
||
<section id="code-example"> | ||
<h2>Pushup example</h2> | ||
<pre><code><span class="keyword">^^import</span> <span class="go">"time"</span> | ||
|
||
<span class="keyword">^^</span>{ | ||
<span class="go">title := "Hello, from Pushup!"</span> | ||
} | ||
|
||
<span class="html"><h1></span><span class="simple-expr">^^title</span><span class="html"></h1></span> | ||
|
||
<span class="html"><p></span>The time is now <span class="simple-expr">^^time.Now().String()</span>.<span class="html"></p></span> | ||
|
||
<span class="keyword">^^if</span> <span class="go">time.Now().Weekday() == time.Friday</span> { | ||
<span class="html"><p></span>It's Friday! Enjoy the start to your weekend.<span class="html"></p></span> | ||
} <span class="keyword">^^else</span> { | ||
<span class="html"><p></span>Have a great day, we're glad you're here.<span class="html"></p></span> | ||
} | ||
</code></pre> | ||
<p>File <kbd>app/pages/hello.up</kbd> → <kbd>/hello</kbd> URL path</p> | ||
</section> | ||
|
||
<section> | ||
<h2>Features</h2> | ||
|
||
<ul id="feature-list"> | ||
<li> | ||
<strong>Page-oriented</strong> | ||
<p>Pushup’s .up files are self-contained units of web app development, gluing HTML & Go together with routing logic</p> | ||
</li> | ||
<li> | ||
<strong>File-based routing</strong> | ||
<p>Filesystem path names of Pushup pages map to URL paths, with dynamic escape hatches</p> | ||
</li> | ||
<li> | ||
<strong>World’s first ‟<a href="https://htmx.org/">htmx</a>-first” framework</strong> | ||
<p>Enhanced hypertext support via inline partials for better client-side interactivity with fewer JavaScript sit-ups</p> | ||
</li> | ||
<li> | ||
<strong>Compiled</strong> | ||
<p>Pushup apps compile to pure Go, built on the standard <code>net/http</code> package. Fast static binary executables for easy deployment. Easy to integrate into larger Go apps</p> | ||
</li> | ||
<li> | ||
<strong>Hot reload dev mode</strong> | ||
<p>App is recompiled and reloaded in the browser while files change during development. This is fast thanks to the Go compiler</p> | ||
</li> | ||
</ul> | ||
</section> | ||
|
||
<section> | ||
<h2>Getting started</h2> | ||
|
||
<ul> | ||
<li><strong>Download Pushup</strong> preview release v0.1 | ||
<ul> | ||
<li>Linux | ||
<ul> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-linux-arm64.zip">Linux AArch64</a></li> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-linux-amd64.zip">Linux x86-64</a></li> | ||
</ul> | ||
</li> | ||
<li>macOS | ||
<ul> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-darwin-arm64.zip">macOS Apple silicon</a></li> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-darwin-amd64.zip">macOS x86-64</a></li> | ||
</ul> | ||
</li> | ||
<li>OpenBSD | ||
<ul> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-openbsd-arm64.zip">OpenBSD AArch64</a></li> | ||
<li><a href="https://github.com/adhocteam/pushup/releases/download/v0.1/pushup-openbsd-amd64.zip">OpenBSD x86-64</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<p>Download Pushup for more platforms on the <a href="https://github.com/adhocteam/pushup/releases">official releases page</a>. | ||
</li> | ||
<li><strong>Read the documentation</strong> | ||
<p><a hx-boost="true" href="/docs/">Pushup docs</a></p> | ||
</li> | ||
<li><strong>Read the source & join the community</strong> | ||
<p><a href="https://github.com/adhocteam/pushup">GitHub repo</a></p> | ||
</li> | ||
</ul> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package build | ||
|
||
import ( | ||
"bytes" | ||
"html/template" | ||
|
||
"github.com/yuin/goldmark" | ||
) | ||
|
||
func convertMarkdown(text []byte) template.HTML { | ||
var buf bytes.Buffer | ||
if err := goldmark.Convert(text, &buf); err != nil { | ||
panic(err) | ||
} | ||
return template.HTML(buf.String()) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Getting started | ||
|
||
To make a new Pushup app, first install the main Pushup executable. | ||
|
||
### Installing Pushup | ||
|
||
#### Prerequisites | ||
|
||
- go 1.18 or later | ||
|
||
Make sure the directory where the go tool installs executables is in your | ||
`$PATH`. It is `$(go env GOPATH)/bin`. You can check if this is the case with: | ||
|
||
```shell | ||
echo $PATH | grep $(go env GOPATH)/bin > /dev/null && echo yes || echo no | ||
``` | ||
|
||
#### Install via official release | ||
|
||
Binary executables for multiple platforms are available for download on the | ||
[project releases page](https://github.com/adhocteam/pushup/releases). | ||
|
||
#### Install via git | ||
|
||
```shell | ||
git clone https://github.com/adhocteam/pushup | ||
cd pushup | ||
make | ||
``` | ||
|
||
#### Install via `go install` | ||
|
||
Make sure you have Go installed (at least version 1.18), and type: | ||
|
||
```shell | ||
go install github.com/adhocteam/pushup@latest | ||
``` | ||
|
||
#### Install via `homebrew` | ||
|
||
Coming soon. | ||
|
||
#### Install via Linux package managers | ||
|
||
Coming soon. | ||
|
||
### Creating a new Pushup project | ||
|
||
To create a new Pushup project, use the `pushup new` command. | ||
|
||
```shell | ||
pushup new | ||
``` | ||
|
||
Without any additional arguments, it will attempt to create a scaffolded new | ||
project in the current directory. However, the directory must be completely | ||
empty, or the command will abort. To simulataneously make a new directory | ||
and generate a scaffolded project, pass a relative path as argument: | ||
|
||
```shell | ||
pushup new myproject | ||
``` | ||
|
||
The scaffolded new project directory consists of a directory structure for | ||
.up files and auxiliary project Go code, and a go.mod file. | ||
|
||
Change to the new project directory if necessary, then do a `pushup run`, | ||
which compiles the Pushup project to Go code, builds the app, and starts up | ||
the server. | ||
|
||
```shell | ||
pushup run | ||
``` | ||
|
||
If all goes well, you should see a message on the terminal that the Pushup app | ||
is running and listening on a port: | ||
|
||
``` | ||
↑↑ Pushup ready and listening on 0.0.0.0:8080 ↑↑ | ||
``` | ||
|
||
By default it listens on port 8080, but with the `-port` or `-unix-socket` | ||
flags you can pick your own listener. | ||
|
||
Open [http://localhost:8080/](http://localhost:8080/) in your browser to see | ||
the default layout and a welcome index page. | ||
|
||
### Listing routes | ||
|
||
You can print a list of all the routes in your Pushup project with the command | ||
`pushup routes`. | ||
|
||
The lefthand column is the URL route, where any dynamic path segments are | ||
denoted with a leading `:` colon. The righthand column is the corresponding | ||
Pushup page. | ||
|
||
For example: | ||
|
||
```shell | ||
$ pushup routes | ||
/about about.up | ||
/album/:id album/$id.up | ||
/album/delete/:id album/delete/$id.up | ||
/album/edit/:id album/edit/$id.up | ||
/album/new album/new.up | ||
/album/ album/index.up | ||
/dyn/:name dyn/$name.up | ||
/htmx/active-search htmx/active-search.up | ||
/htmx/click-to-load htmx/click-to-load.up | ||
/htmx/ htmx/index.up | ||
/htmx/value-select htmx/value-select.up | ||
/ index.up | ||
/projects/:pid/users/:uid projects/$pid/users/$uid.up | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Guides | ||
|
||
_Coming soon_ | ||
|
||
## Enhanced hypermedia | ||
|
||
- How to use htmx with Pushup | ||
|
||
## Deployment | ||
|
||
- How to deploy a Pushup app using fly.io | ||
- How to deploy a Pushup app using Netlify | ||
- How to deploy a Pushup app using Render | ||
- How to deploy a Pushup app using AWS | ||
|
||
## Databases | ||
|
||
- How to make Pushup app with SQLite | ||
- How to make Pushup app with PostgreSQL | ||
|
||
## App types | ||
|
||
- How to make a CRUD app with Pushup | ||
- How to make a static site with Pushup |
Oops, something went wrong.