Tagexpress

Stubbing middleware when testing an Express with Supertest

S

When testing a simple express app / api I like to use supertest. This can feel like integration testing, and to an extent it is. But we can stub things out with sinon, and tidy up our tests. Let’s look at an example. Suppose we have a simple API with the following router: var express = require('express'), app = express(); var router = express.Router(); app.use('/', require('./router'));...

Node RailwayJS app – Deploying to Heroku – ENOENT, open ‘/app/log/production.log

N

I’m currently working on a project involving a node.js app, using RailwayJS, deploying to Heroku. After doing my git push Heroku Everything seemed ok, however, the app was not running. I ran Heroku logs and was shown: app[web.1]: listening on port 32168 within production environment app[web.1]: app[web.1]: events.js:48 app[web.1]: throw arguments[1]; // Unhandled ‘error’ event...