First Heroku deploy failed `error code=H10`

Found solution for me here: Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch) In my case my app crashed because I was hard setting the PORT, instead of using the port that heroku dinamicaly sets, which can be accessed with process.env.PORT app.listen(process.env.PORT || 3000, function(){ console.log(“Express server … Read more

Difference between app.all(‘*’) and app.use(‘/’)

In most cases they would work equivalently. The biggest difference is the order in which middleware would be applied: app.all() attaches to the application’s router, so it’s used whenever the app.router middleware is reached (which handles all the method routes… GET, POST, etc). NOTICE: app.router has been deprecated in express 4.x app.use() attaches to the … Read more

SyntaxError: Unexpected token function – Async Await Nodejs

Async functions are not supported by Node versions older than version 7.6. You’ll need to transpile your code (e.g. using Babel) to a version of JS that Node understands if you are using an older version. That said, versions of Node.js which don’t support async functions are now all past End Of Life and are … Read more

express.js – single routing handler for multiple routes in a single line

I came across this question while looking for the same functionality. @Jonathan Ong mentioned in a comment above that using arrays for paths is deprecated but it is explicitly described in Express 4, and it works in Express 3.x. Here’s an example of something to try: app.get( [‘/test’, ‘/alternative’, ‘/barcus*’, ‘/farcus/:farcus/’, ‘/hoop(|la|lapoo|lul)/poo’], function ( request, … Read more