Can't route to root in restify?

I’ve found that adding the following route:

var server = restify.createServer();
server.post('/', ...);

leads to mysterious errors and prevents the application from starting. Specifying anything other than root:

server.post('/something', ...);

works just fine.

Is this a limitation of restify? I can’t see any evidence of that in its source.

Is this a HyperDev thing?

I can imagine that it’s probably not recommended to POST to root, but that’s a separate discussion :wink:

1 Like

Repro with a clean instance:

Note that Express seems to be happy to route a POST to root, so this may be unrelated to HyperDev.

I think I’ve run into what’s happening here before with restify. HyperDev needs to respond to head to be considered running. So adding a route for that, the app starts and you can then POST to root: https://hyperdev.com/#!/project/fringe-sight

Interesting! So I guess Express, being a heavier framework, handles this automatically, whereas restify does not, as it’s intentionally lightweight.

Good sort of thing to mention in HyperDev documentation somewhere :slight_smile:

Thanks!

And just so I don’t spread rumors, it looks like Express is also intended to be lightweight.

pssst, I heard Chuck say that Express isn’t lightweight… :wink:

We’re looking for a less intrusive way of checking to see if your app is ready to serve requests, so this may change moving forward. Right now we do HEAD / to make sure you’re ready, and we’ll get this documented more visibly.

2 Likes