import * as dotenvSafe from 'dotenv-safe'; import express from 'express'; import consola from 'consola'; import * as jwt from 'jsonwebtoken'; import { createConnection } from 'typeorm'; dotenvSafe.config(); const app = express(); const PORT = process.env.APP_PORT || 4010; createConnection() .then((connection) => { app.get('/', (req, res) => { const encoded = jwt.sign({ key: 'value' }, 'secret'); consola.info(encoded); return res.send('Express + TypeScript Server'); }); app.listen(PORT, () => { consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`); }); }) .catch((err) => { consola.error(err); app.get('/', (req, res) => { const encoded = jwt.sign({ key: 'value' }, 'secret'); consola.info(encoded); return res.send('Express + TypeScript Server'); }); app.listen(PORT, () => { consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`); }); });