Giter VIP home page Giter VIP logo

go-figure-api's Introduction

Go Figure API

A Go backend service for the go figure web app. This is inspired by the Fourier series circle drawings video by 3Blue1Brown.

This application accepts a series of continuous points captured at even time intervals, and a requested number of draw vectors to calculate. The calculation job is put onto a queue that is processed continuously. Once the job is complete, the results are available at the drawing's uri as a list of vectors with real and imaginary parts that can then be animated.

Build Status Go Report Card

Routes

/drawing

Method: POST

Input:

{
	"points": [
		{"x": 143, "y": 45, "time": 0},
		{"x": 144, "y": 49, "time": 0.01}
	]
}

Output:

{"id": 1}

/drawing/:id

Method: GET

Output:

{
	"id": 1,
	"points": [
		{"x": 143, "y": 45, "time": 0},
		{"x": 144, "y": 49, "time": 0.01}
	],
	"drawVectors": {
		"calculated": [
			{"n": 0, "real": 0, "imaginary": 2},
			{"n": 1, "real": 0, "imaginary": 2.5},
			{"n": -1, "real": 0.5, "imaginary": 2.7}
		],
	},
	"dateCreated": "2020-01-01 12:00:00"
}

/drawings/recent

Method: GET

Output:

[
	{
		"id": 2,
		"svgPath": "M 364 113 L 364 113 L 357 113 L 348 113 L 342 113 L 337 113 L 333..."
	},
	{
		"id": 1,
		"svgPath": "M 364 113 L 364 113 L 357 113 L 348 113 L 342 113 L 337 113 L 333..."
	}
]

Tests

Tests require the presence of a mysql database connection. You can easily get this by running this from the project root:

docker-compose up

Wait for the mysql container spin up and then run the tests like:

docker-compose exec api sh -c "go test -v ./.../test"

go-figure-api's People

Contributors

janhartigan avatar sdsomma avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.