-
Notifications
You must be signed in to change notification settings - Fork 670
/
Copy pathindex.js
38 lines (29 loc) · 1.23 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const configure = require('./configure')
const { getCurrentInvoke } = require('./current-invoke')
module.exports = configure
module.exports.getCurrentInvoke = getCurrentInvoke
module.exports.configure = configure
// Legacy/deprecated:
function createServer (app, serverListenCallback, binaryMimeTypes) {
console.warn('[DEPRECATION NOTICE] You\'re using the deprecated createServer method that will be removed in the next major version. See https://github.com/CodeGenieApp/serverless-express/blob/mainline/UPGRADE.md to upgrade.')
if (serverListenCallback) {
throw new Error('serverListenCallback is no longer supported.')
}
const configureOptions = {
app,
binarySettings: {
contentTypes: binaryMimeTypes
}
}
return configureOptions
}
function proxy (configureOptions, event, context, resolutionMode, callback) {
console.warn('[DEPRECATION NOTICE] You\'re using the deprecated proxy method that will be removed in the next major version. See https://github.com/CodeGenieApp/serverless-express/blob/mainline/UPGRADE.md to upgrade.')
const se = configure({
...configureOptions,
resolutionMode
})
return se(event, context, callback)
}
module.exports.createServer = createServer
module.exports.proxy = proxy