Simple REST endpoint generation in Go
- Sysl v0.11.0 or later
- Go 1.13
- Click the
Use this template
button up the top - ctrl-f and replace all instances of
github.com/joshcarp/sysl-ci
with your import path, eggithub.com/foobar/myrepo
- run
make
- note:
make
must be run with a working internet connection, as it fetches transforms and grammars over the network.
- note:
- run
go run main.go
- congrats! you've just made your first sysl application!
- Refer to the Makefile to generate client and server code for all of your applications
api/: contains all API specifications for the generated application
gen/: contains all the generated code for the service
internal/server/server.go: The hand-written code that's written; Server config and such
pkg/defaultcallback: contains code that sets up the defaults for generated code. (This will no longer be necessary in future Sysl versions)
When new endpoints are added, they need to be added to the simple.ServiceInterface
variable in server.go
main.go: runs the actual server
run make
to regenerate application code
First you need to edit the start of the Makefile:
input = your input sysl file
app = < the app you want to develop>
down = <downstreams in a list separated by spaces>
basepath = <Your current go module path>
so: make input=model/simple.sysl app=Simple
for this example
run go run main.go
to start the server