Skip to content

Instantly share code, notes, and snippets.

'use strict';
const { send, json } = require('micro');
const { router, get, post, del } = require('microrouter');
const rateLimit = require('micro-ratelimit');
const cors = require('micro-cors')();
const database = require('../../database/db');
const model = require('../../model/index');
const controller = require('../../controller/index');
const { logRequest } = require('../../middlewares/mid');
Request body
While constructing requests, you would be dealing with the request body editor a lot. Postman lets you send almost any kind of HTTP request (If you can't send something, let us know!). The body editor is divided into 4 areas and has different controls depending on the body type.
form-data
multipart/form-data is the default encoding a web form uses to transfer data. This simulates filling a form on a website, and submitting it. The form-data editor lets you set key/value pairs (using the key-value editor) for your data. You can attach files to a key as well. Do note that due to restrictions of the HTML5 spec, files are not stored in history or collections. You would have to select the file again at the time of sending a request.
urlencoded
'use strict';
const {send, json} = require('micro');
const {router, get, post} = require('microrouter');
const rateLimit = require('micro-ratelimit');
const cors = require('micro-cors')();
const database = require('../../database/db');
const model = require('../../model/index');
const controller = require('../../controller/index');
// GENERAL
'use strict';
class FetchDataManagerSingleton extends Map {
static get [Symbol.species]() {
return Map;
}
constructor() {
this.fetchCount = 0;
this.timeTilNextFetch = 5000;
// Js classes with extends
// https://jsfiddle.net/2j9fg96b/
class Datastream {
constructor(solution, key) {
this.solution = solution;
this.key = key;
}
toString() {
// ECMA 6
// https://jsfiddle.net/9L8bv237/
class Datastream {
constructor(solution, key) {
this.solution = solution;
this.key = key;
}
exec() {
// https://jsfiddle.net/pamadvmu/
function DataStream(solution, key) {
this.solution = solution;
this.key = key;
this.exec = function() {
return 'Executing ' + this.key;
}
}
var templatePrefix1 = `
var variables = new java.util.HashMap();
variables.put("procInstId", "
`;
var templatePrefix2 = `
map.put("proc_inst_id", "
`;
var templateSufix1 = `
[victor.costa@treinamento ~]$ sudo yum update
[sudo] password for victor.costa:
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
* base: mirrors.greenmountainaccess.net
* extras: mirrors.centos.webair.com
* updates: mirror.sesp.northwestern.edu
Resolving Dependencies
--> Running transaction check
------------------------------------------------
procInstId:
b775b6bf451549eaab3eddb1150fd874
-------------------------------------------------
-------------------------------------------------
typeof procInstId:
string