Git Product home page Git Product logo

api.danielmcfarland.dev's Introduction

Micropub API

Introduction

This application can be used to gain an access_token in order to create a post on danielmcfarland.dev.

To log in visit api.danielmcfarland.dev/auth.

You will be prompted to login with IndieAuth and then be redirected back with an access token.

This token can then be used as an parameter when making a request to api.danielmcfarland.dev/micropub

You will need a GITHUB_API_KEY in order to write to the repo and add the post contents.

The GitHub repo this writes to is hardcoded. It is my intention to make this more configurable in the future.

curl --location 'https://api.danielmcfarland.dev/micropub' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'h=entry' \
--data-urlencode 'access_token=####' \
--data-urlencode 'bookmark-of=https://danielmcfarland.dev'

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

An .env file is required with the following parameters locally

PORT=8080
APP_URL=https://local_url_for_callback
GITHUB_API_KEY=

MakeFile

run all make commands with clean tests

make all build

build the application

make build

run the application

make run

Create DB container

make docker-run

Shutdown DB container

make docker-down

live reload the application

make watch

run the test suite

make test

clean up binary from the last build

make clean

Deployment

I deploy this to fly.io, you will need to add a secret token for GI# Micropub API

Introduction

This application can be used to gain an access_token in order to create a post on danielmcfarland.dev.

To log in visit api.danielmcfarland.dev/auth.

You will be prompted to login with IndieAuth and then be redirected back with an access token.

This token can then be used as an parameter when making a request to api.danielmcfarland.dev/micropub

You will need a GITHUB_API_KEY in order to write to the repo and add the post contents.

The GitHub repo this writes to is hardcoded. It is my intention to make this more configurable in the future.

curl --location 'https://api.danielmcfarland.dev/micropub' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'h=entry' \
--data-urlencode 'access_token=####' \
--data-urlencode 'bookmark-of=https://danielmcfarland.dev'

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

An .env file is required with the following parameters locally

PORT=8080
APP_URL=https://local_url_for_callback
GITHUB_API_KEY=

MakeFile

run all make commands with clean tests

make all build

build the application

make build

run the application

make run

Create DB container

make docker-run

Shutdown DB container

make docker-down

live reload the application

make watch

run the test suite

make test

clean up binary from the last build

make clean

Deployment

I deploy this to fly.io, you will need to add a secret token for GITHUB_API_KEY to the application on fly.io

api.danielmcfarland.dev's People

Contributors

danielmcfarland avatar

Watchers

 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.