strongloop/loopback-component-push

Cannot POST /notify/1123 (custom route)

Closed this issue · 2 comments

Hi,
I have imported the client package from server to server-2.0 (loopback-component-push) to manually push to a particular device form index.html. But when I execute the "notify/:id" customer route as written in push-demo.js it gives me the following error. I think in loopback 2.0 there is the new routing way. If so is there an example to follow? I have tried to put a routing in router/index.js file and included the router in server.js, it can find the route but it cannot find the notification/installation models from app.

Error: Cannot POST /notify/1123
    at raiseUrlNotFoundError (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/lib/middleware/urlNotFound.js:15:17)
    at Layer.handle [as handle_request] (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/layer.js:82:5)
    at trim_prefix (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:271:13)
    at /Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:238:9
    at Function.proto.process_params (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:313:12)
    at /Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:229:12
    at Function.match_layer (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:296:3)
    at next (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/index.js:190:10)
    at serveStatic (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/node_modules/serve-static/index.js:59:14)
    at Layer.handle [as handle_request] (/Users/shahriarnewaz/AndroidStudioProjects/assignment/probe/probe-server/node_modules/loopback/node_modules/express/lib/router/layer.js:82:5)

Please try e7c715c

I'm with the same problem, right now at 2017.
Anyone POST works.

PS: I'm with NODE.JS updated.