-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (26 loc) · 886 Bytes
/
app.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
const express = require('express');
const app = express();
const image_resize = require('./routes/resize');
require('dotenv').config();
const fs = require("fs");
const check_dir = function (path) {
try {
if (fs.existsSync(path)) {
console.log("Directory exists.", path);
} else {
console.log("Directory does not exist, please create", path);
}
} catch
(e) {
console.log("An error occurred", e);
}
};
check_dir(process.env.INPUT_PATH);
check_dir(process.env.OUTPUT_PATH);
check_dir(process.env.UPLOAD_PATH);
// app.use('/uploads', express.static(path.join(__dirname, '/uploads')));
app.use('/api/image', image_resize);
app.get('/', (req, res) => {
res.status(200).send("Hello World");
});
app.listen(process.env.PORT, () => console.log(`node application started listening on port ${process.env.PORT}`));