This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) { | |
/******/ return installedModules[moduleId].exports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'isomorphic-fetch' | |
fetch('http://www.google.com/index.html') | |
.then((response) => response.text()) | |
.then((html) => { | |
// Work with the body. | |
}) | |
.catch((e) => { | |
console.log(`Got error: ${e.message}`); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const xhr = new XMLHttpRequest(); | |
xhr.onload = () => { | |
// Consume response body. | |
const body = xhr.responseText; | |
} | |
xhr.onerror = (e) => { | |
console.log(`Got error: ${e.message}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http' | |
http.get('http://www.google.com/index.html', (res) => { | |
console.log(`Got response: ${res.statusCode}`); | |
// consume response body | |
res.resume(); | |
}).on('error', (e) => { | |
console.log(`Got error: ${e.message}`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Express = require('express') | |
var Rill = require('rill') | |
// Setup express app. | |
var expressApp = Express() | |
expressApp.use(...) | |
expressApp.get('/', ...) | |
// Setup rill app. | |
var rillApp = Rill() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var TEXT_TYPE = 3 | |
var ELEMENT_TYPE = 1 | |
var NODE_KEY = '__set-dom-key__' | |
var NODE_INDEX = '__set-dom-index__' | |
var HTML_ELEMENT = document.createElement('html') | |
var BODY_ELEMENT = document.createElement('body') | |
module.exports = setDOM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use an isomorphic form-data/body parser. | |
app.use(require("@rill/body")()); | |
// Register our form page route as normal. | |
app.get("/my-form-page", ({ req, res })=> { | |
res.body = <MyForm/> | |
}); | |
// Setup our post route. | |
app.post("/my-form-submit", ({ req, res })=> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lets register another route. | |
app.get("/away", ({ req, res })=> { | |
res.body = <AwayPage/>; | |
}); | |
// And make another simple React component. | |
function AwayPage (props) { | |
return ( | |
<html> | |
<head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creating an app is familiar. | |
const app = require("rill")(); | |
// Lets pull in some middleware! | |
app.use(require("@rill/logger")()); // Setup logging. | |
app.use(require("@rill/react")()); // Setup our react renderer. | |
// Lets make our index page! | |
app.get("/", ({ req, res })=> { | |
// Simply set the response body to a React Element. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require("lodash") | |
_.chain(emails) | |
.chunk(100) | |
.filter("to") | |
.unshift(Promise.resolve()) | |
.reduce((p, batch)=> { | |
p.then(()=> { | |
fetch("http://myapi.com/email", { | |
method: "POST", |
NewerOlder