-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.js
50 lines (38 loc) · 769 Bytes
/
init.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
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Init
*/
// ++ Express
const express = require('express')
const app = express()
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
// ++ OCR
const ocr = require('./ocr')
/**
* Init
*/
async function init() {
/**
* Express
*/
try { await app.listen(80) }
catch (e) { console.error("Init -> server exception", e.toString()) }
console.log("Init -> server listening")
/**
* Init OCR
*/
ocr.init()
/**
* GET - Health check
*/
app.get('*/health', (req, res) => res.sendStatus(200))
/**
* GET - Test
*/
app.get('*/test', async (req, res) => res.json(await ocr.test()))
/**
* Not Found
*/
app.use((req, res, next) => res.status(404).send({ status: "error", "msg": "404 Not Found" }))
}
init()