I hereby claim:
- I am musawirali on github.
- I am musawir (https://keybase.io/musawir) on keybase.
- I have a public key whose fingerprint is 3B14 C1F3 9E72 F7E8 81CC EC4E 586B E11C FC7A 6B05
To claim this, I am signing this object:
Verifying my Blockstack ID is secured with the address 1LHMkw9himmh1E3xWoyAUnzzpN4uG3TKtX https://explorer.blockstack.org/address/1LHMkw9himmh1E3xWoyAUnzzpN4uG3TKtX |
package main | |
import ( | |
"fmt" | |
"net/http" | |
"github.com/musawirali/preact-rpc/goclient" | |
) | |
// HTTP request handler |
const request = { | |
id: 1, // Some number that uniquely identifies a request | |
component: 'hello', // The name of the component as registered in Javascript | |
props: { // The props to pass to the component to be rendered | |
toWhat: 'World', | |
}, | |
}; |
preact-rpc --bundle=./Component.js --port=tmp/server.sock |
import React from 'react'; | |
import { registerComponent } from 'preact-rpc'; | |
// A simple React component | |
class Hello extends React.Component { | |
render() { | |
return React.createElement('div', null, `Hello ${this.props.toWhat}`); | |
} | |
} |
import React from 'react'; | |
// A simple React component | |
class Hello extends React.Component { | |
render() { | |
return React.createElement('div', null, `Hello ${this.props.toWhat}`); | |
} | |
} |
class ApiController < ApplicationController | |
# Will not be exchanging CSRF token, not doing any API auth either. | |
skip_before_filter :verify_authenticity_token | |
def update_name | |
name = params[:name] | |
return render json: {error: 'Invalid name'} if name.blank? || name.match(/[a-z0-9]+/i).to_s != name | |
# TODO: check for valid URL | |
url = params[:url] |
I hereby claim:
To claim this, I am signing this object:
= javascript_include_tag "webpack/my_app-bundle" |
# ReactOnRails config | |
ReactOnRails.configure do |config| | |
# This is a manifest file of all the components that we need to have server-side rendering for | |
config.server_bundle_js_file = "app/assets/javascripts/webpack/react_server-bundle.js" | |
end |