Skip to content

Instantly share code, notes, and snippets.

@neverendingqs
Created August 18, 2018 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neverendingqs/6cc14e919c8bb51f0ce038913404c6e9 to your computer and use it in GitHub Desktop.
Save neverendingqs/6cc14e919c8bb51f0ce038913404c6e9 to your computer and use it in GitHub Desktop.
2017/03/13/ensure-all-nock-interceptors-are-used.html - updatedserver.js
'use strict';
const request = require('superagent');
const express = require('express');
const app = express();
app.get('/', function(req, res) {
request
.get('https://www.example.com')
.then(response => res.send(response.text))
// add a catch here and return a custom message
.catch(response => res.status(503).send('Please try again later.'));
});
app.listen(3000);
module.exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment