1.1.0 • Published 8 years ago
ajaxmanager v1.1.0
ajaxmanager
v1.1.0 ( last update: 24 oct 2017 )
Manager to simplify the receiving and responding of post requests.
Install
npm i ajaxmanager --saveNode.js
var ajaxmanager = require("ajaxmanager");Initialization
var ajax = ajaxmanager.create();
ajax.set({
req: req,
res: res
});DB
ajax.set({ db: db });Errors
Set error and end session
ajax.error("wrong data");Add more that one error
ajax.adderror("Error 1");
ajax.adderror("Error 2");
ajax.adderror("Error 3");Completion
When everything is done
ajax.success(); // response = { error: false };Send file
ajax.reply(file); // response = { error: false, pkg: file};Send file instead everything else
ajax.send(file); // response = file