Orbit SSR
Golang SSR framework featuring native react support with zero boilerplate.
ATTENTION: The current state of master is a WIP to a stable build.
Installation
Manual
To install manually, please download the correct distributable target for your machine. Next, you can either put it directly
in the directory you wish to use it in (and call it directly) or put it into your bash profile.
Examples
For more examples, visit the ./examples directory.
Simple Example
- Create a /pages directory in your root directory
- Build out your react page(s) in the /pages directory.
// example_page.jsx
import React from 'react'
const ExamplePage = ({name}) => {
return (
<>
<h1> Example! </h1>
<p> {name} </p>
</>
)
}
export default ExamplePage
- Run
orbit build
to build your application.
- Create a handler for your page.
// ...import the generated orbit golang files here
type ExamplePageHandler struct {}
// orbit is referenced from the golang files that the orbit build command generates
func (e *ExamplePageHandler) Handle(c *orbit.RuntimeCtx) {
propData := make(map[string]interface{})
propData["name"] = "Bob"
c.RenderPage(orbit.ExamplePage, propData)
}
- Apply the handler to the http server in main.go
// main.go
// ...import the generated orbit golang files here
func main() {
orbit.HandlePage("/", &ExamplePageHandler{})
orbit.Start(3000)
}
- Run the application
go run main.go
Contributing
Running the project
To run the project, please first download the required tools.
- nodeJS >= v11
- golang 1.14
Building the project
After golang is installed on your machine, you can build with go run build
Running tests
After golang is installed on your machine, you can run tests with go test