forked from jeremydaly/lambda-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_testApp.js
More file actions
36 lines (28 loc) · 781 Bytes
/
Copy path_testApp.js
File metadata and controls
36 lines (28 loc) · 781 Bytes
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
'use strict'
const Promise = require('bluebird');
module.exports = {
app: function(req,res) {
// do something
res.json({ method:'get', status:'ok', app:'app1'})
},
promise: function(req,res) {
let start = Date.now()
Promise.try(() => {
for(let i = 0; i<40000000; i++) {}
return true
}).then((x) => {
res.json({ method:'get', status:'ok', app:'app2'})
})
},
calledError: function(req,res) {
res.status(500).error('This is a called module error')
},
thrownError: function(req,res) {
throw new Error('This is a thrown module error')
},
dataTest: function(req,res) {
// Use data namespace
let data = req.ns.data.dataCall()
res.json({ method:'get', status:'ok', data: data })
},
} // end exports