Home

Awesome

Micro-medium-api

Microservice for fetching the latest posts of Medium with GraphQL.

Further reading: [中文] Microservice 產品交付 - Dockerize 與 Zeit JavaScript 跨平台解決方案

Travis Codecov Status Github Tag node

Dependency Status devDependency Status peerDependency Status Greenkeeper badge prettier license

Feature

How To Use

a. Deploy to Now.sh

One click deploys to △ now

Deploy to now

b. Binary executable

Download from GitHub latest release.

$ ORIGIN=$YOUR_DOMAIN \
  ./micro-medium-api-macos --port $PORT

Note: You can run it without Node.js installed.

c. Docker image

Pull from dockerhub.

Docker Automated build Docker Pulls Docker Size

$ docker pull evenchange4/micro-medium-api:latest
$ docker run --rm -it \
  -p $PORT:3000 \
  -e "ORIGIN=YOUR_DOMAIN" \
  evenchange4/micro-medium-api:latest

d. NPM CLI

Install from npm.

npm downloads npm

$ npm i micro-medium-api -g
 
$ ORIGIN=$YOUR_DOMAIN \
  micro-medium-api --port $PORT

Note: You should use Node.js >= 8 .

API

Environment variables

ENVRequiredDefaultDescription
ORIGIN*Setup access-control-allow-origin for CORS.

CLI arguments

$ micro-medium-api --help
Usage: micro-medium-api <command> [options]
 
Options:
  -p, --port     HTTP server PORT                                [default: 3000]
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]

GraphQL endpoint

Demo

Note: You should deploy your own service for production usage.

Technology Stacks

Developer Guide

Requirements

$ git clone https://github.com/evenchange4/micro-medium-api.git
$ yarn install --pure-lockfile

$ yarn run dev # dev server
$ yarn start   # prod server
$ yarn run pkg # output binary files

Test

$ yarn run format
$ yarn run eslint
$ yarn run test:watch

Docker

$ docker build -t micro-medium-api .

# Push to dockerhub
$ git push

Note: Multi-stage builds are a new feature in Docker 17.05.

Github release / NPM release

$ npm version patch
$ git push

Inspiration

CONTRIBUTING

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org