Skip to content

Instantly share code, notes, and snippets.

View heron2014's full-sized avatar

Anita Czapla heron2014

  • London
View GitHub Profile
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };
@heron2014
heron2014 / hapi-boom-json-api.js
Created July 22, 2016 16:16
hapi plugin to reformat boom errors to json-api
exports.register = function (plugin, options, done) {
plugin.ext('onPreResponse', function (request, reply) {
var response = request.response;
if (response.isBoom) {
var error = {
title: response.output.payload.error,
status: response.output.statusCode,
detail: response.output.payload.message