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
#install global nodeyness | |
npm install -g serverless | |
serverless create --template aws-nodejs --path al_serverless | |
cd al_serverless | |
#local dependencies for apollo and stuff | |
npm install --save apollo-server-lambda graphql-tools lodash |
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
/** | |
* refer here: | |
* https://github.com/lewisdaly/iota_mam_examples/ | |
* for the rest of the code examples | |
*/ | |
declare var require: any | |
const Mam = require('../lib/mam.node.js'); | |
const IOTA = require('iota.lib.js'); |
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
declare var require: any | |
declare var process: { | |
env: { | |
ROOT: string | |
} | |
} | |
var Mam = require('../lib/mam.node.js') | |
var IOTA = require('iota.lib.js') |
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 five = require("johnny-five"), | |
board = new five.Board(); | |
board.on("ready", function () { | |
// Create an Led on pin 13 | |
var led = new five.Led(13); | |
// Strobe the pin on/off, defaults to 100ms phases | |
led.strobe(200); | |
}); |
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 IOTA = require('iota.lib.js'); | |
const MAM = require('./lib/mam.client.js/lib/mam.client'); | |
var iota = new IOTA({ provider: `https://testnet140.tangle.works` }); | |
const five = require("johnny-five"); | |
const board = new five.Board(); | |
// Initialise MAM State - PUBLIC | |
var mamState = MAM.init(iota) |
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 IOTA = require('iota.lib.js'); | |
const MAM = require('./lib/mam.client.js/lib/mam.client'); | |
var iota = new IOTA({ provider: `https://testnet140.tangle.works` }) | |
const five = require("johnny-five"); | |
const board = new five.Board(); | |
// Initialise MAM State - PUBLIC |
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
/*iota library */ | |
const IOTA = require('iota.lib.js'); | |
const { | |
provider, | |
functionName, | |
trytes //todo: remove | |
} = require('./config'); | |
//Please don't ever use this seed for anything | |
const seed = "UFLKWXVHYTPDBAOJS9CQMGNRZEI"; |
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
/*iota library */ | |
const IOTA = require('iota.lib.js'); | |
const { provider, functionName } = require('./config'); | |
const iota = new IOTA({ | |
provider, | |
}); | |
/* set up AWS config to refer to our lambda */ | |
const AWS = require('aws-sdk'); | |
const lambda = new AWS.Lambda({ | |
region: 'ap-southeast-2' //I come from a land down under |
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
service: apollo-lambda | |
provider: | |
name: aws | |
runtime: nodejs6.10 | |
region: ap-southeast-2 | |
stage: development | |
functions: | |
graphql: | |
handler: handler.graphql | |
events: |
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'; | |
const server = require("apollo-server-lambda"); | |
const schema = require('./schema'); | |
exports.graphql = server.graphqlLambda((event, context) => { | |
const headers = event.headers; | |
const functionName = context.functionName; | |
return { | |
schema: schema, |
OlderNewer