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 request = require('request'); | |
request.post( | |
'https://formio.form.io/user/login', | |
{ | |
data: { | |
'email': email, | |
'password': password | |
} | |
}, |
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 superagent from 'superagent'; | |
import config from '../config'; | |
import cookie from 'react-cookie'; | |
const methods = ['get', 'post', 'put', 'patch', 'del']; | |
function formatUrl(path) { | |
const adjustedPath = path[0] !== '/' ? '/' + path : path; | |
if (__SERVER__) { | |
// Prepend host and port of the API server to the path. |
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
// Define an HTTP request handler | |
function requestHandler(request, response) { | |
try { | |
if ("setting" in request.query) { | |
// 'setting' is a URL-encoded parameter, ie. '/setting=4' | |
local settingValue = request.query.setting; | |
// Use the 'response' object to acknowledge reception of the request | |
// to the request's source. '200' is HTTP status code for 'OK' | |
response.send(200, "Setting received and applied"); |