Skip to content

Commit 347b0ba

Browse files
committed
using console-files package, start checkout endpoint
1 parent bc28b26 commit 347b0ba

File tree

10 files changed

+22
-68
lines changed

10 files changed

+22
-68
lines changed

bin/web.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// log on files
4-
const logger = require('./../lib/Logger.js')
4+
const logger = require('console-files')
55
// https://www.npmjs.com/package/rest-auto-router
66
const restAutoRouter = require('rest-auto-router')
77

lib/Logger.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

main.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,9 @@
88
* @author E-Com Club
99
*/
1010

11-
process.on('uncaughtException', (err) => {
12-
// fatal error
13-
// log to file before exit
14-
let msg = '\n[' + new Date().toString() + ']\n'
15-
if (err) {
16-
if (err.hasOwnProperty('stack')) {
17-
msg += err.stack
18-
} else if (err.hasOwnProperty('message')) {
19-
msg += err.message
20-
} else {
21-
msg += err.toString()
22-
}
23-
msg += '\n'
24-
}
25-
26-
let fs = require('fs')
27-
fs.appendFile('/var/log/nodejs/_stderr', msg, () => {
28-
process.exit(1)
29-
})
30-
})
11+
// debug errors in files
12+
// require logger module first of any code
13+
require('console-files')
3114

3215
// web application
3316
// recieve requests from Nginx by reverse proxy

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"rest-auto-router": "3.x",
1414
"ajv": "5.x",
1515
"ajv-i18n": "2.x",
16+
"console-files": "2.x",
1617
"axios": "0.x"
1718
}
1819
}

routes/#modules.js renamed to routes/#applications.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// log on files
4-
const logger = require('./../lib/Logger.js')
4+
const logger = require('console-files')
55

66
// JSON Schema validation with AJV
77
// based on http://json-schema.org/

routes/@checkout.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
// log on files
4+
// const logger = require('console-files')
5+
6+
const GET = (id, meta, body, respond) => {
7+
respond('Hello')
8+
}
9+
10+
module.exports = {
11+
GET
12+
}

routes/calculate_shipping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// import common verbs (methods) functions
4-
const httpVerbs = require('./#modules.js')
4+
const httpVerbs = require('./#applications.js')
55
const modName = 'calculate_shipping'
66

77
const schema = {

routes/create_transaction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// import common verbs (methods) functions
4-
const httpVerbs = require('./#modules.js')
4+
const httpVerbs = require('./#applications.js')
55
const modName = 'create_transaction'
66

77
const schema = {

routes/list_payments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// import common verbs (methods) functions
4-
const httpVerbs = require('./#modules.js')
4+
const httpVerbs = require('./#applications.js')
55
const modName = 'list_payments'
66

77
const schema = {

routes/page_loaded.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
// import common verbs (methods) functions
4-
const httpVerbs = require('./#modules.js')
4+
const httpVerbs = require('./#applications.js')
55
const modName = 'page_loaded'
66

77
const schema = {

0 commit comments

Comments
 (0)