diff --git a/.gitignore b/.gitignore index 176b417..c156b28 100644 --- a/.gitignore +++ b/.gitignore @@ -127,4 +127,5 @@ dist .yarn/install-state.gz .pnp.* yarn.lock -package-lock.json \ No newline at end of file +package-lock.json +build diff --git a/ormconfig.ts b/ormconfig.ts deleted file mode 100644 index d4d7647..0000000 --- a/ormconfig.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { config } from "dotenv-safe"; -config(); - -export default { - "type": process.env.DB_TYPE, - "host": process.env.DB_HOST, - "port": process.env.DB_PORT, - "username": process.env.DB_USER, - "password": process.env.DB_PASSWORD, - "database": process.env.DB_NAME -} \ No newline at end of file diff --git a/package.json b/package.json index f27f47a..5c255d5 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "typescript": "^4.1.2" }, "scripts": { - "dev": "nodemon src/app.ts" + "dev": "nodemon src/app.ts", + "build": "tsc" } } diff --git a/src/app.ts b/src/app.ts index ccdde8b..f036136 100644 --- a/src/app.ts +++ b/src/app.ts @@ -9,18 +9,11 @@ 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}`); - }); - }) + .then((connection) => {}) .catch((err) => { consola.error(err); + }) + .finally(() => { app.get('/', (req, res) => { const encoded = jwt.sign({ key: 'value' }, 'secret'); consola.info(encoded); diff --git a/src/ormconfig.ts b/src/ormconfig.ts new file mode 100644 index 0000000..5804b09 --- /dev/null +++ b/src/ormconfig.ts @@ -0,0 +1,11 @@ +import { config } from 'dotenv-safe'; +config(); + +export default { + type: process.env.DB_TYPE, + host: process.env.DB_HOST, + port: process.env.DB_PORT, + username: process.env.DB_USER, + password: process.env.DB_PASSWORD, + database: process.env.DB_NAME +};