Deploy a react app with serverless function in minutes (online demo):
-
Create a basic react app
$ npx create-react-app netlify-react-demo --use-npm
| var GoogleSpreadsheet = require('google-spreadsheet') | |
| , Profess = require('profess') | |
| , config, profess, spreadsheet, errorHandller; | |
| config = { | |
| gdocKey: process.argv[2] || '0AilC0U4Eb0tjdGEwR1RDTlRrbnVHbUVBWjBSVHk5OVE', // Sample doc https://docs.google.com/a/octo.com/spreadsheet/ccc?key=0AilC0U4Eb0tjdGEwR1RDTlRrbnVHbUVBWjBSVHk5OVE&usp=drive_web#gid=0 | |
| googleLogin: process.argv[3], | |
| googlePwd: process.argv[4], | |
| worksheetIndex: 0 | |
| }; |
| #!/usr/bin/env node | |
| 'use strict'; | |
| // Read stdin JSON, sort keys and pretty format to stdout | |
| var stdin = process.stdin, | |
| stdout = process.stdout, | |
| chunks = []; |
| var funcs = [ | |
| function hello() { | |
| console.log('hello'); | |
| }, | |
| function world() { | |
| console.log('world'); | |
| }, | |
| function foo() { | |
| console.log('foo'); | |
| }, |
| #!/bin/sh | |
| # -*-Shell-script-*- | |
| # | |
| # chkconfig: 35 99 99 | |
| # description: initd startup script for nodejs app <%= name %> | |
| # | |
| . /etc/rc.d/init.d/functions |
| 'use strict'; | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| const _ = require('lodash'); | |
| const hat = require('hat'); | |
| const homeDir = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME']; | |
| const src = path.join(homeDir, 'actifs.res'); | |
| const dest1 = path.join(homeDir, 'actifs.res.out1'); | |
| const dest2 = path.join(homeDir, 'actifs.res.out2'); |
Deploy a react app with serverless function in minutes (online demo):
Create a basic react app
$ npx create-react-app netlify-react-demo --use-npm