Created
January 28, 2016 03:40
-
-
Save travist/2eae831b8ca266bbab4f to your computer and use it in GitHub Desktop.
Form.io Node.js Remote Middleware Binding
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
var formio = require('formio-service')(); | |
var Project = formio.Project; | |
// First authenticate. | |
formio.authenticate('[email protected]', 'password').then(function() { | |
// Create a new project instance. | |
var project = new project('https://myapp.form.io'); | |
// Bind to a form. | |
project.bind('myform', 'POST', function(error, request, response) { | |
console.log(request); | |
/** | |
* You can also change the response by doing the following... | |
*/ | |
response({ | |
status: 404, | |
message: 'This is a custom message' | |
}); | |
}, true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the code does not run anymore