1234567891011121314151617 |
- const app = require('../app');
- const db = require('../model/db');
- const createFolderIsExist = require('../helpers/create-directory');
- const PORT = process.env.PORT || 3000;
- db.then(() => {
- app.listen(PORT, async () => {
- const DIR_UPLOAD = process.env.DIR_UPLOAD;
- const DIR_STATIC = process.env.DIR_STATIC;
- await createFolderIsExist(DIR_UPLOAD);
- await createFolderIsExist(DIR_STATIC);
- console.log(`Server running. Use our API on port: ${PORT}`);
- });
- }).catch((err) => {
- console.log(`Server not running. Error message: ${err.message}`);
- process.exit(1);
- });
|