This file contains hidden or 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
{ | |
"name": "Retweet Stoplight's latest tweet", | |
"description": "This scenario will grab the latest Stoplight tweet, and retweet it. The twitter API requires that requests be authenticated with oauth1. Before you can run this scenario, you must fill out the variables below.\n\n1. Create a new app at [https://apps.twitter.com](https://apps.twitter.com). No callback url needed.\n2. Navigate to the keys and access tokens tab of your app (see screenshot), and copy paste the tokens and secrets below.\n3. Click run scenario above!\n\n", | |
"steps": [ | |
{ | |
"functions": [ | |
{ | |
"name": "Get latest tweet", | |
"input": { | |
"authorization": { |
This file contains hidden or 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
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0", | |
"title": "To-do Demo", | |
"description": "## Welcome\n\nThis is a place to put general notes and extra information, for internal use.\n\nTo get started designing/documenting this API, select a version on the left." | |
}, | |
"host": "todos.stoplight.io", | |
"schemes": [ | |
"http" |
This file contains hidden or 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
{ | |
"swagger": "2.0", | |
"schemes": [ | |
"http" | |
], | |
"basePath": "/api", | |
"host": "localhost:3000", | |
"info": { | |
"version": "", |
This file contains hidden or 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
{ | |
"swagger": "2.0", | |
"host": "myapi.com", | |
"schemes": ["http"], | |
"info": {}, | |
"paths": {}, | |
"definitions": {}, | |
"x-stoplight": { | |
"beforeScript": "function(ctx, request) {}", | |
"afterScript": "function(ctx, request, response) { // messages contain any warnings or errors var messages = response.validate(); var isValid = response.valid.get(); // Set a header here, so that your testing tools can throw errors appropriately if (isValid) { response.header.set('Validation', 'Passed'); } else { response.header.set('Validation', 'Failed'); } }", |
This file contains hidden or 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
{ | |
"port": "4010", | |
"forwardHost": null, | |
"basePath": null, | |
"log": false, | |
"logLocation": "https://api.stoplight.io/v1", | |
"debug": true, | |
"mock": { | |
"enabled": false, |
This file contains hidden or 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
| files.readFile 3 ms (3) | |
| files.exists 1 ms (4) | |
| files.writeFileAtomically.....................................2,958 ms (2) | |
| ├─ files.writeFile 2,953 ms (2) | |
| └─ files.rename 5 ms (2) | |
| Rebuild App.................................................102,326 ms (1) | |
| ├─ compiler.compile(the app)....................................142 ms (1) | |
| │ └─ compileUnibuild (the app).................................142 ms (2) | |
| │ ├─ files.readdir 19 ms (126) | |
| │ ├─ files.stat 9 ms (813) |
This file contains hidden or 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
// Load the http module to create an http server. | |
var http = require('http'); | |
var largeResponse = require('./large_response.json') | |
largeResponse = JSON.stringify(largeResponse) | |
// Configure our HTTP server to respond with Hello World to all requests. | |
var server = http.createServer(function (request, response) { | |
response.writeHead(200, {"Content-Type": "application/json"}); |
This file contains hidden or 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
package main | |
import ( | |
"bytes" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) |
This file contains hidden or 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 runAction = (name, action, commonArgs, args) => { | |
console.log(`signals:${name}:${action.name}`, {action: action, commonArgs: commonArgs, args: args}) | |
try { | |
return action(commonArgs, args) | |
} catch(e) { | |
console.error(`Error running ${action.name} action for the ${name} signal.`, | |
{action: action, err: e, commonArgs: commonArgs, args: args}) | |
return Promise.reject(e) | |
} |
This file contains hidden or 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
// actions.js provides functions to fetch | |
// remote data and store it in the tree | |
// these remote functions should return | |
// promises | |
require('es6-promise').polyfill(); | |
var stateTree = require('./stateTree'), | |
PostModel = require('./post'), | |
fetch = require('isomorphic-fetch'), |