We'll use NixOps to deploy, so we need to install it
nix-env -i nixops
And to deploy on DigitalOcean we need to have an account and create an API access token for it.
js_include conf.d/oauth2.js; | |
server { | |
listen 80; | |
server_name localhost; | |
root /usr/share/nginx/html; | |
location / { | |
auth_request /_auth_init; | |
} |
<?php | |
add_action('rest_api_init', function() { | |
// Surface all Gutenberg blocks in the WordPress REST API | |
$post_types = get_post_types_by_support( [ 'editor' ] ); | |
foreach ( $post_types as $post_type ) { | |
if ( gutenberg_can_edit_post_type( $post_type ) ) { |
We'll use NixOps to deploy, so we need to install it
nix-env -i nixops
And to deploy on DigitalOcean we need to have an account and create an API access token for it.
// | |
// inspired by https://stackoverflow.com/a/838755/521197 | |
// | |
function getDPI() { | |
var div = document.createElement( "div"); | |
div.style.height = "1in"; | |
div.style.width = "1in"; | |
div.style.top = "-100%"; | |
div.style.left = "-100%"; | |
div.style.position = "absolute"; |
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone
generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers