mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 03:29:37 +02:00
SQLite database. App model and controller
This commit is contained in:
parent
8392c2422a
commit
2acc3b72ec
11 changed files with 1185 additions and 32 deletions
18
server.js
18
server.js
|
@ -1,13 +1,27 @@
|
|||
const express = require('express');
|
||||
const { connectDB } = require('./db');
|
||||
const errorHandler = require('./middleware/errorHandler');
|
||||
const colors = require('colors');
|
||||
require('dotenv').config();
|
||||
|
||||
connectDB();
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 5005;
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('hello');
|
||||
res.send('Server is working');
|
||||
})
|
||||
|
||||
// Body parser
|
||||
app.use(express.json());
|
||||
|
||||
// Link controllers with routes
|
||||
app.use('/api/apps', require('./routes/apps'));
|
||||
|
||||
// Custom error handler
|
||||
app.use(errorHandler);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT}`);
|
||||
console.log(`Server is running on port ${PORT} in ${process.env.NODE_ENV} mode`.yellow.bold);
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue