62
63req.get =
64▶req.header = function header(name) {
65 if (!name) {
66 throw new TypeError('name argument is required to req.get');
· · ·
125 */
126
127▶req.accepts = function(){
128 var accept = accepts(this);
129 return accept.types.apply(accept, arguments);
· · ·
138 */
139
140▶req.acceptsEncodings = function(){
141 var accept = accepts(this);
142 return accept.encodings.apply(accept, arguments);
· · ·
169 */
170
171▶req.acceptsCharsets = function(...charsets) {
172 const accept = accepts(this);
173 return accept.charsets(...charsets);
· · ·
183 */
184
185▶req.acceptsLanguages = function(...languages) {
186 return accepts(this).languages(...languages);
187};
+ 27 more matches in this file
57 */
58
59▶app.init = function init() {
60 var router = null;
61
· · ·
70 configurable: true,
71 enumerable: true,
72▶ get: function getrouter() {
73 if (router === null) {
74 router = new Router({
· · ·
88 */
89
90▶app.defaultConfiguration = function defaultConfiguration() {
91 var env = process.env.NODE_ENV || 'development';
92
· · ·
96 this.set('env', env);
97 this.set('query parser', 'simple')
98▶ this.set('subdomain offset', 2);
99 this.set('trust proxy', false);
100
· · ·
107 debug('booting in %s mode', env);
108
109▶ this.on('mount', function onmount(parent) {
110 // inherit trust proxy
111 if (this.settings[trustProxyDefaultSymbol] === true
+ 37 more matches in this file
28// Routes
29
30▶app.get('/', function(req, res){
31 res.render('index.ejs');
32});
· · ·
33
34▶app.get('/404', function(req, res, next){
35 // trigger a 404 since no other middleware
36 // will match /404 after this one, and we're not
· · ·
39});
40
41▶app.get('/403', function(req, res, next){
42 // trigger a 403 error
43 var err = new Error('not allowed!');
· · ·
46});
47
48▶app.get('/500', function(req, res, next){
49 // trigger a generic (500) error
50 next(new Error('keyboard cat!'));
· · ·
61// $ curl http://localhost:3000/notfound -H "Accept: text/plain"
62
63▶app.use(function(req, res, next){
64 res.status(404);
65
+ 6 more matches in this file
17*/
18
19▶// Main server app
20
21var main = express();
· · ·
21▶var main = express();
22
23if (!module.parent) main.use(logger('dev'));
· · ·
23▶if (!module.parent) main.use(logger('dev'));
24
25main.get('/', function(req, res){
· · ·
25▶main.get('/', function(req, res){
26 res.send('Hello from main app!');
27});
· · ·
26▶ res.send('Hello from main app!');
27});
28
+ 4 more matches in this file
6 , url = require('node:url');
7
8▶describe('res', function(){
9 describe('.location(url)', function(){
10 it('should set the header', function(done){
· · ·
9▶ describe('.location(url)', function(){
10 it('should set the header', function(done){
11 var app = express();
· · ·
10▶ it('should set the header', function(done){
11 var app = express();
12
· · ·
13▶ app.use(function(req, res){
14 res.location('http://google.com/').end();
15 });
· · ·
21 })
22
23▶ it('should preserve trailing slashes when not present', function(done){
24 var app = express();
25
+ 46 more matches in this file
338 - Fix `expires` option to reject invalid dates
339 * deps: depd@2.0.0
340▶ - Replace internal `eval` usage with `Function` constructor
341 - Use instance methods on `process` to check for listeners
342 * deps: finalhandler@1.2.0
· · ·
533 * Add `options` argument to `res.download`
534 * Improve error message when autoloading invalid view engine
535▶ * Improve error messages when non-function provided as middleware
536 * Skip `Buffer` encoding when not generating ETag for small response
537 * Use `safe-buffer` for improved Buffer API
· · ·
769 - Add `sameSite` option
770 - Fix cookie `Max-Age` to never be a floating point number
771▶ - Improve error message when `encode` is not a function
772 - Improve error message when `expires` is not a `Date`
773 - Throw better error for invalid argument to parse
· · ·
790 - deps: ipaddr.js@1.1.1
791 * deps: qs@6.2.0
792▶ - Add `decoder` option in `parse` function
793 * deps: range-parser@~1.2.0
794 - Add `combine` option to combine overlapping ranges
· · ·
795 - Fix incorrectly returning -1 when there is at least one valid range
796▶ - perf: remove internal function
797 * deps: send@0.14.1
798 - Add `acceptRanges` option
+ 21 more matches in this file
4 , request = require('supertest');
5
6▶describe('req', function(){
7 describe('.subdomains', function(){
8 describe('when present', function(){
· · ·
7▶ describe('.subdomains', function(){
8 describe('when present', function(){
9 it('should return an array', function(done){
· · ·
8▶ describe('when present', function(){
9 it('should return an array', function(done){
10 var app = express();
· · ·
9▶ it('should return an array', function(done){
10 var app = express();
11
· · ·
12▶ app.use(function(req, res){
13 res.send(req.subdomains);
14 });
+ 43 more matches in this file