• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Microservice for fetching the latest posts of Medium with GraphQL.

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

  • Use GraphQL.
  • Dataloader for per-request memory cache.
  • Rate-limiting 1 requests per sec.

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

ENV Required Default Description
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

  • [GET] /graphql
  • [POST] /graphql

Demo

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

Technology Stacks

  • Micro: Asynchronous HTTP microservices.
  • Micro-router: A tiny and functional router for Zeit's Micro.
  • Micro-ratelimit: Rate-limiting middleware for micro.
  • Graphql-tools: ๐Ÿ”ง Build and mock your GraphQL.js schema using the schema language.
  • Graphql-server-micro: ๐ŸŒ GraphQL server
  • Dataloader: DataLoader is a generic utility to be used as part of your application's data fetching layer to provide a consistent API over various backends and reduce requests to those backends via batching and caching.
  • Dockerhub: Automatically deploy docker image.
  • Now.sh: Realtime global deployments
  • Pkg: Package your Node.js project into an executable
  • Travis: CI

Developer Guide

Requirements

  • node >= 8.5.0
  • npm >= 5.3.0
  • yarn >= 1.0.2
$ 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

  • โ‡„ Pull requests and โ˜… Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ yarn run test).

CHANGELOG

LICENSE

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

More Repositories

1

graphql.macro

Compile GraphQL AST at build-time with babel-plugin-macros.
JavaScript
239
star
2

react-progressive-bg-image

๐Ÿ–ผ Medium style progressive background image.
JavaScript
228
star
3

gh-polls-bot

Automatically create polls in GitHub issues.
JavaScript
213
star
4

react-intl-po

๐Ÿš€ Extract POT from react-intl and convert back to json.
JavaScript
89
star
5

nextjs-pkg-docker-alpine

๐Ÿ“ฅDeploy a commercial Next.js application with pkg and docker.
JavaScript
74
star
6

react-intl-cra

๐Ÿ”ง Extract messages of Creact React App from the command line.
JavaScript
67
star
7

react-grecaptcha

React.js Google reCAPTCHA v2 integration component.
JavaScript
51
star
8

svgr.macro

Run svgr at build-time with babel-plugin-macros.
JavaScript
43
star
9

react-intl-po-example

๐Ÿ‘‰ This is a standalone project for using react-intl-po with CRA.
HTML
38
star
10

react-intl.macro

Extract react-intl messages with babel-plugin-macros.
JavaScript
37
star
11

micro-website-api

An API microservice that crawls dynamic website powered by puppeteer.
JavaScript
29
star
12

graphql.macro-example

JavaScript
23
star
13

todomvc-subscriptions

Fullstack TodoMVC with GraphQL subscriptions.
JavaScript
22
star
14

nextjs-tfjs-cnn

๐Ÿ• ๐Ÿˆ Classifier using Keras VGG16 transfer learning with kaggle dataset.
Jupyter Notebook
14
star
15

react-lifecycle-hoc

Higher-order components of react lifecycle. โœจ
JavaScript
13
star
16

redux-csrf

Keep your csrf token inside your Redux store.
JavaScript
11
star
17

calendar-todo

๐Ÿ“… Google calendar todo list application with GraphQL proxy
JavaScript
10
star
18

react-image-onload

React Image onLoad event.
JavaScript
10
star
19

react-input-files

Reusable React input file component.
JavaScript
9
star
20

michaelhsu.tw

evenchange4.github.io/michaelhsu.tw ๐Ÿ‘‰
JavaScript
8
star
21

dotenv.macro

Inline dotenv at build-time with babel-plugin-macros.
JavaScript
8
star
22

react-livescript-seed

DEPRECATED: Quick starter of React-Flux LiveScript Project seed.
LiveScript
7
star
23

ethereum-hot-wallet

A react-native hot wallet that communicates with geth node.
JavaScript
6
star
24

react-dnd-dropzone

Dropzone with render props built with react-dnd.
JavaScript
6
star
25

apollo-link-log

Log side effect for Apollo Link.
JavaScript
6
star
26

react-svg-drag-and-select

[WIP] A SVG playground to drag and select shape elements.
JavaScript
6
star
27

react-overlay-pack

Reusable components to build Tooltip, Popover and Dialog.
JavaScript
5
star
28

react-draggable-playground

Reusable React-draggable components with render props.
JavaScript
5
star
29

remark-utils

Reusable utils to build markdown service power by remarkjs and elasticlunr.
JavaScript
4
star
30

micro-github-latest

Microservice for downloading the latest asset of GitHub release.
JavaScript
4
star
31

react-ga-hoc

Send GA pageview safely with async data.
JavaScript
4
star
32

mrt_opendata

ๆท้‹็ซ™ๅๆจ™
Ruby
3
star
33

michaelhsu

The Michael Hsu CLI
JavaScript
3
star
34

docker-tfjs-converter

Docker image for tfjs-converter
Dockerfile
3
star
35

react-intl.macro-example

JavaScript
2
star
36

svgr.macro-example

HTML
2
star
37

102-2_NLP_Project_Sentiment-Analysis

Aspect-based Sentiment Analysis
Ruby
2
star
38

to-object-by

Reduce an Array into Object for indexing purpose.
JavaScript
2
star
39

LAB_WSJ_crawler

Wall Street Journal crawler
JavaScript
1
star
40

102-1_SP_PA2_Multiplexing-Web-Server

Assignment 2 - Multiplexing Web Server
C
1
star
41

crna-expo

๐Ÿ“ฑ A react-native playground.
JavaScript
1
star
42

101-1_IR_PA2_-Cosine-Similarity

Ruby tf-idf Cosine-Similarity
Ruby
1
star
43

WebMining_PA2

WMPA2 PageRank + LexRank
C++
1
star
44

imagemin-simple

Replace images with minified one and generate small base64 image.
JavaScript
1
star
45

CCSP

[101-2] NTU cloud computing special project
R
1
star
46

cv

๐Ÿ“Michael Hsu's CV
TeX
1
star
47

102-1_DS_PA2_ADT-Table

implementation of ADT Table by using STL mapใ€list
C++
1
star
48

number-with-commas

Convert a Number to a string with commas.
JavaScript
1
star
49

to-percentage-by

Convert a Float number to percentage with rounding, ceiling or flooring.
JavaScript
1
star
50

cra-electron

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป A electron playground with Create-React-App.
JavaScript
1
star
51

blog

CSS
1
star
52

ng-alert

AngularJS component for easily creating Alert.
CSS
1
star
53

hsu-scripts

CLI toolbox for common scripts for npm libraries.
JavaScript
1
star
54

lint-config-m

Lint config with eslint and stylelint.
JavaScript
1
star
55

gulp-livereload

Gulp.js + LiveReload with node.js http-server
JavaScript
1
star