todoapp

module
v0.0.0-...-17b6e18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: Apache-2.0

README

todoapp

A sample client server ToDo app based on http://todomvc.com/ and https://www.todobackend.com/

Running it

You need a Go 1.14+ installation. After cloning this repo, cd into the server/ directory and type go run server.go. The point your browser at:

  • http://localhost:3000/flutter/ for the Flutter UI
  • http://localhost:3000/vecty/ for the Vecty WASM UI
  • http://localhost:3000/swagger/ for the Swagger API documentation

Goal and Approach

The goal of this project is to evaluate and familiarize myself with a variety of tools for building web apps. Some of the things I think I know:

  • Want to build backend in Go.
  • Would like to do API-first development.
  • Would like to use Swagger/OpenAPI for specifying and documenting the API.
  • Might want to use Swagger/OpenAPI for automating parts of development process, i.e. code generation.
  • Flutter is an interesting tool for building front-ends.

I decided to proceed by building a version of the ToDoMVC app with the tools I wanted to evaluate. Because I want a server backend with an API, I decided to implement the API used by todobackend.com. They maintain a test suite for a standard backend. I also found some Swagger definitions for a ToDo backend, although none of them exactly matched the todobackend.com spec.

I first experimented with a workflow using a Swagger/OpenAPI defintion to generate a Go server framework. All of the tools I tried had weaknesses, either in the Go code they generated or the workflow to use them.

I decided instead to author the Go server by hand, using net/http and Gorilla Mux. I used Swag to generate Swagger and associated documentation pages. It was pretty easy to add annotations in comments and use go:generate to run Swag to keep doc in sync with code.

I experimented with two different front ends. I used Flutter to build a (so far) incomplete one. Because I had some experience with Vecty a Go/WASM front end framework, I took their ToDoMVC example and hooked it up to the server. For both front ends, I used the openapi-generator tool to generate client code.

Directories

Path Synopsis
store/storeutil
Package storeutil contains a ListenerRegistry type.
Package storeutil contains a ListenerRegistry type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL