mirror of
https://github.com/pawelmalak/snippet-box.git
synced 2025-12-21 21:33:10 +01:00
Added SQLite database with migrations
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import dotenv from 'dotenv';
|
||||
import express from 'express';
|
||||
import { Logger } from './utils';
|
||||
import { connectDB } from './db';
|
||||
|
||||
// Env config
|
||||
dotenv.config({ path: './src/config/.env' });
|
||||
@@ -9,8 +10,15 @@ const app = express();
|
||||
const logger = new Logger();
|
||||
const PORT = process.env.PORT;
|
||||
|
||||
app.listen(PORT, () => {
|
||||
logger.log(
|
||||
`Server is working on port ${PORT} in ${process.env.NODE_ENV} mode`
|
||||
);
|
||||
});
|
||||
// App config
|
||||
app.use(express.json());
|
||||
|
||||
(async () => {
|
||||
await connectDB();
|
||||
|
||||
app.listen(PORT, () => {
|
||||
logger.log(
|
||||
`Server is working on port ${PORT} in ${process.env.NODE_ENV} mode`
|
||||
);
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user