Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

postpress

An interface to consume WordPress posts through The WordPress REST API.

postpress screenshot


Get started using yarn:

Install system requirements:

Open a terminal, clone this repository, and run the following in the root of the project:

Serve the project in production:

  • yarn run serve

Get started using docker:

Install system requirements:

Setup a development environment:

  • Build the environment:
    • yarn run docker-env-development-build
  • Start the environment:
    • yarn run docker-env-development-start
  • Execute commands inside the running containers:
    • docker exec -it 010011111-postpress-node-development /bin/bash -c 'cd /postpress && yarn install'
  • Get a shell inside a running container:
    • docker exec -it 010011111-postpress-node-development /bin/bash

Setup a testing environment:

  • Build the environment:
    • yarn run docker-env-testing-build
  • Start the environment:
    • yarn run docker-env-testing-start

With the testing environment started:

  • Run the jest unit tests inside the node development container:
    • yarn run docker-test-jest
  • Run the nightwatch tests against the selenium standalone firefox container:
    • yarn run docker-test-nightwatch-firefox
  • Run the nightwatch tests against the selenium standalone chrome container:
    • yarn run docker-test-nightwatch-chrome

Setup a staging / production environment:

  • Build the environment:
    • yarn run docker-env-production-build
  • Start the environment:
    • yarn run docker-env-production-start

Setup a stand-alone production environment based on Alpine Linux:

  • Build the image:
    • yarn run docker-env-production-alpine-build
  • Save the image to a file:
    • docker save postpress | xz > postpress.tar.xz
  • Transfer the file to another host and load it:
    • xzcat postpress.tar.xz | docker load
  • Run postpress:
    • docker run -it -p 80:80 -d postpress

Config

Setup the config in config/development.js and config/production.js based on the WordPress REST API you will connect to:

Example 1: Your main blog is hosted @ https://www.example.com and

  site: {
    title: 'Title',
    tagline: 'Tagline',
    url: 'https://www.example.com/blog/',
    api: {
      categories: {
        list: {
          url: 'https://www.example.com/blog/wp-json/wp/v2/categories',
          per_page: 100
        },
        posts: {
          url: 'https://www.example.com/blog/wp-json/wp/v2/posts/?categories={integer}',
          per_page: 3
        }
      },
      root: {
        posts: {
          url: 'https://www.example.com/blog/wp-json/wp/v2/posts/',
          per_page: 3
        }
      }
    },
    routes: {
      about: '/about/',
      categories: '/blog/category/:category',
      root: '/',
      singleArticle: '/blog/:article'
    }
  }

Example 2: Your main blog is hosted on http://example.com and

  site: {
    title: 'Title',
    tagline: 'Tagline',
    url: 'http://example.com/',
    api: {
      categories: {
        list: {
          url: 'http://example.com/wp-json/wp/v2/categories',
          per_page: 100
        },
        posts: {
          url: 'http://example.com/wp-json/wp/v2/posts/?categories={integer}',
          per_page: 3
        }
      },
      root: {
        posts: {
          url: 'http://example.com/wp-json/wp/v2/posts/',
          per_page: 3
        }
      }
    },
    routes: {
      about: '/about/',
      categories: '/category/:category/',
      root: '/',
      singleArticle: '/:year(\\d{4})/:month(\\d{2})/:day(\\d{2})/:article/'
    }
  }

Build Status

postpress logo

You can’t perform that action at this time.