hassio-nextcloud-backup/nextcloud_backup/backend/src/server.ts

30 lines
773 B
TypeScript
Raw Normal View History

import errorHandler from "errorhandler";
2022-09-27 23:38:40 +02:00
import "./env.js";
import app from "./app.js";
2022-09-27 23:38:40 +02:00
import logger from "./config/winston.js";
import postInit from "./postInit.js";
import figlet from "figlet";
import kleur from 'kleur';
/**
* Error Handler. Provides full stack
*/
if (process.env.NODE_ENV === "development") {
app.use(errorHandler());
}
/**
* Start Express server.
*/
const server = app.listen(app.get("port"), () => {
2022-09-27 23:38:40 +02:00
console.log(kleur.yellow().bold(figlet.textSync("NC Backup")))
logger.info(
`App is running at ` + kleur.green().bold(`http://localhost:${app.get("port")}`) + " in " + kleur.green().bold(app.get("env")) + " mode"
);
2022-09-27 23:38:40 +02:00
logger.info(kleur.red().bold("Press CTRL-C to stop"));
postInit();
});
export default server;