forked from leafoflegend/MemeMagic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (17 loc) · 777 Bytes
/
app.js
File metadata and controls
24 lines (17 loc) · 777 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
'use strict';
import myServer from './server';
import HTTP from 'http';
import startDB from './server/db';
import chalk from 'chalk';
const server = HTTP.createServer();
const _Port = 3001;
import ioInit from './server/sockets';
import { getYesNo } from 'cli-interact';
const syncTruth = getYesNo(chalk.cyan('Rick, do you wanna get savage on this database? (Force Sync)'));
// If you want to remove the syncTruth, change syncTruth to true or false manually.
// The order of initializing the backend.
startDB(syncTruth)
.then(() => server.on('request', myServer))
.then(() => ioInit(server))
.catch(err => console.error(err))
.finally(() => server.listen(_Port, () => console.log(chalk.magenta(`Meme magic has begun on Port ${_Port}`))));