distributed

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

README

Distributed

How remote teams stay in sync

Overview

Build a knowledge base, ask questions and stay in sync with your team all while doing it asynchronously. Distributed is a building block for remote teams and communities. Write posts, leave comments and upvote the most relevant content.

Demo

Go to distributed.m3o.app for a live demo.

Source

Find the source code on GitHub.

Usage

Distributed is built as a single Go server with embedded html and backed by the DB and User APIs on M3O for storage and authentication.

API Key

Get an API key from m3o.com and export as

export M3O_API_TOKEN=xxxxxx
Server

Download and install

go get godistributed.org/cmd/distributed

Run the server

distributed

Your app should be running on localhost:8080

Development

For local development clone the project

git clone https://github.com/godistributed/distributed
  • Edit frontend html/js/css in distributed/html/
  • Edit backend APIs in distributed/distributed.go

Run the app

go run distributed/cmd/distributed

Documentation

Overview

Package distributed is for building federated communities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Boards

func Boards(w http.ResponseWriter, req *http.Request)

func Comments

func Comments(w http.ResponseWriter, req *http.Request)

func Cors

func Cors(w http.ResponseWriter, req *http.Request) bool

func Login

func Login(w http.ResponseWriter, req *http.Request)

func Logout

func Logout(w http.ResponseWriter, req *http.Request)

func NewBoard

func NewBoard(w http.ResponseWriter, req *http.Request)

func NewComment

func NewComment(w http.ResponseWriter, req *http.Request)

func NewPost

func NewPost(w http.ResponseWriter, req *http.Request)

func Posts

func Posts(w http.ResponseWriter, req *http.Request)

func ReadSession

func ReadSession(w http.ResponseWriter, req *http.Request)

func Run

func Run(address string)

Run the server on a given address

func Signup

func Signup(w http.ResponseWriter, req *http.Request)

func VoteWrapper

func VoteWrapper(upvote bool, isComment bool) func(w http.ResponseWriter, req *http.Request)

Types

type Board

type Board struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Moderators  []string `json:"moderators"`
	Created     string   `json:"created"`
}

type BoardRequest

type BoardRequest struct {
	Board     Board  `json:"board"`
	SessionID string `json:"sessionId"`
}

type BoardsRequest

type BoardsRequest struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	Limit int32  `json:"limit"`
}

type Comment

type Comment struct {
	Content   string  `json:"content"`
	Parent    string  `json:"board"`
	Upvotes   float32 `json:"upvotes"`
	Downvotes float32 `json:"downvotes"`
	PostId    string  `json:"postId"`
	UserName  string  `json:"usernName"`
	UserId    string  `json:"userId"`
}

type CommentRequest

type CommentRequest struct {
	Comment   Comment `json:"comment"`
	SessionID string  `json:"sessionId"`
}

type CommentsRequest

type CommentsRequest struct {
	PostId string `json:"postId"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LogoutRequest

type LogoutRequest struct {
	SessionID string `json:"sessionId"`
}

type Post

type Post struct {
	Id           string  `json:"id"`
	UserId       string  `json:"userId"`
	UserName     string  `json:"userName"`
	Content      string  `json:"content"`
	Created      string  `json:"created"`
	Upvotes      float32 `json:"upvotes"`
	Downvotes    float32 `json:"downvotes"`
	Score        float32 `json:"score"`
	Title        string  `json:"title"`
	Url          string  `json:"url"`
	Board        string  `json:"board"`
	CommentCount float32 `json:"commentCount"`
}

type PostRequest

type PostRequest struct {
	Post      Post   `json:"post"`
	SessionID string `json:"sessionId"`
}

type PostsRequest

type PostsRequest struct {
	Min   int32  `json:"min"`
	Max   int32  `json:"max"`
	Limit int32  `json:"limit"`
	Board string `json:"board"`
	Id    string `json:"id,omitempty"`
}

type SignupRequest

type SignupRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
}

type VoteRequest

type VoteRequest struct {
	Id        string `json:"id"`
	SessionID string `json:"sessionId"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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