Was attempting to use Webtask.io as a middleware solution in my current application, but my problem is that I can't get the express.js hello world example to work. All I want is this express server to reply "Hello Grails" when hit with a GET request. My code:
Webtask:
var express = require('express');
var Webtask = require('webtask-tools');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json());
app.get('/', function (req, res) {
res.send({greeting: 'Hello Grails!'})
});
module.exports = Webtask.fromExpress(app);
The error that both postman and my Grails app receive is:
{
"code": 400,
"message": "Compilation failed: Unexpected token <",
"error": "Unexpected token <",
"stack": "SyntaxError: Unexpected token <\n
at Object.exports.runInThisContext (vm.js:53:16)\n ... "
}
The built-in runner for webtask returns "Hello Grails", but plain get requests from Postman and my application don't. What am I doing wrong?
via K. Rhoda
No comments:
Post a Comment