app.response.js — express Source File
Architecture documentation for app.response.js, a javascript file in the express codebase.
Entity Profile
Source Code
'use strict'
var after = require('after')
var express = require('../')
, request = require('supertest');
describe('app', function(){
describe('.response', function(){
it('should extend the response prototype', function(done){
var app = express();
app.response.shout = function(str){
this.send(str.toUpperCase());
};
app.use(function(req, res){
res.shout('hey');
});
request(app)
.get('/')
.expect('HEY', done);
})
it('should only extend for the referenced app', function (done) {
var app1 = express()
var app2 = express()
var cb = after(2, done)
app1.response.shout = function (str) {
this.send(str.toUpperCase())
}
app1.get('/', function (req, res) {
res.shout('foo')
})
app2.get('/', function (req, res) {
res.shout('foo')
})
request(app1)
.get('/')
.expect(200, 'FOO', cb)
request(app2)
.get('/')
.expect(500, /(?:not a function|has no method)/, cb)
})
it('should inherit to sub apps', function (done) {
var app1 = express()
var app2 = express()
var cb = after(2, done)
app1.response.shout = function (str) {
this.send(str.toUpperCase())
}
app1.use('/sub', app2)
// ... (84 more lines)
Source
Frequently Asked Questions
What does app.response.js do?
app.response.js is a source file in the express codebase, written in javascript.
Where is app.response.js in the architecture?
app.response.js is located at test/app.response.js (directory: test).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free