GithubHelp home page GithubHelp logo

tiim / indiego Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 0.0 344 KB

Tiny go api that serves your websites comments. The comments are stored in a lightweight sqlite database.

License: GNU General Public License v3.0

Dockerfile 0.59% Go 99.02% Shell 0.08% CSS 0.31%

indiego's Introduction

IndieGo

This project is a simple, modular but extendable webserver to enable your website to join the IndieWeb.

IndieGo currently supports native comments, sending and receiving webmentions, IndieAuth as well as Micropub. All components are built in a modular way, they can be extended for your own needs or disabled by just commenting them out in the main method.

The API can be queried for comments and webmentions of all pages or just of a single page.

Blogposts about IndieGo

Image of the Go gopher with a speech bubble

Demo

You can try out this project on my Blogpost about this project.

Installation

Using docker

The easiest way to run the go-comment-api is via docker compose. There is a sample docker-compose.yml that I use to host the comments for my website. To see how I deploy it on my webserver see deploy.sh.

  • TODO: document how to use the default config with env variables.
  • TODO: document how to use a custom config file.

Compile it to a static binary

You need a recent go version installed. Run the following command to compile:

go mod download
CGO_ENABLED=0 go build -o comment-api -a .

This binary is self contained and only needs a config file to run. Run it with

./comment-api -config config.json

For an example config file see config.json.

Development

Running Tests

go test ./...

Running migrations in the cli

# Up
goose -dir model/sqlite-migrations/ sqlite3 db/comments.sqlite up
# Down
goose -dir model/sqlite-migrations/ sqlite3 db/comments.sqlite down

Tools

Exposing tunnel to the web

npx ngrok http 8080

For testing IndieAuth:

NGROK_URL=https://<ngok-url> go run . -config config-local.json

Testing indieauth websub / indie reader with aperture

  • Expose app to web via ngrok
  • Register with ngrok url
  • Restart app with APPERTURE_ID=xxx

Node Webmention Testpinger

Source

  • npx webmention-testpinger --endpoint=http://localhost:8080/wm/webmentions --target https://tiim.ch/target -p 8081
  • npx webmention-testpinger --endpoint=http://localhost:8080/wm/webmentions --target http://localhost:5173/projects/lenex-split-sheet -p 8081

Sending single webmention with curl

cd test-data/
python3 -m http.server
curl -i -d source=http://localhost:8000/html/webmention-rocks.html -d target=https://tiim.ch/blog/2022-07-12-first-go-project-commenting-api http://localhost:8080/wm/webmentions

indiego's People

Contributors

tiim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.