/polarite

A somewhat Pastebin alternative with HTTP POST support

Primary LanguageGoGNU General Public License v3.0GPL-3.0

Polarite is a Pastebin alternative made for simplicity written in Go.

Usage

Web Interface

Soon.

API

Send a POST request to link coming soon with:

  • Content-Type header with the value of text/plain
  • Non-empty request body consisting of the text you want to store
  • Authorization header with the value of Your Name <your email> with a minimum of 15 characters.

Example request:

  • cURL
curl \
    -H "Content-Type: text/plain" \
    -H "Authorization: John Doe <john@example.com>" \
    -X POST \
    -d "Hello World" <link coming soon>
  • Javascript (via Fetch API)
fetch("link coming soon", {
    method: "POST",
    headers: {
        "Content-Type": "text/plain",
        "Authorization": "John Doe <john@example.com>"
    },
    body: "Hello world!"
})
  • Go
import (
    "net/http"
    "strings"
)

func Polarite() {
    body := strings.NewReader("Hello world")
    req, err := http.NewRequest(http.MethodPost, "link coming soon", body)
    req.Header.Add("Content-Type", "text/plain")
    req.Header.Add("Authorization", "John Doe <john@example.com>")

    client := &http.Client{}
    resp, err := client.Do(req)
}
  • C#
using System.Net.Http;

var client = new HttpClient();
var request = new HttpRequestMessage() {
    RequestUri = new Uri("link coming soon"),
    Method = HttpMethod.Post,
    Headers = {
        { "Authorization", "John Doe <john@example.com>" },
        { "ContentType", "text/plain" }
    },
    Content = new StringContent("Hello world", Encoding.UTF8, "text/plain")
};

var task = await client.SendAsync(request);

I'm here for Hacktoberfest, what can I do?

If you're new to open source, we really recommend reading a few articles about contributing to open source projects:

You can start by reading the CONTRIBUTING.md. Then you can search for issues that you can work on.

Have fun!

Why the name, Polarite?

In the dawn of time, it began with the birth of Graphene repository, which its' name was picked from the name of a mineral. Then, not so long after, another repository called Flourite emerged. It's actually a typo of Fluorite, another name of a mineral. Now, where mankind stands, we want to continue that convention, to pick a name from a list of mineral on Wikipedia.