-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (23 loc) · 828 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (23 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
const logger = require('morgan');
require('dotenv').config();
const express = require('express');
const app = express();
const getLimiter = require('./middleware/rate-limiter.js');
const auth = require('./routes/authRoutes.js');
const todos = require('./routes/todosRoutes.js');
const db = require('./models');
db.sequelize.sync();
// db.sequelize.sync({ force: true }).then(async () => {
// console.log('drop and resync database')
// });
app.use(getLimiter());
app.use(express.json());
app.use(logger('tiny'));
app.get('/', (req, res) => res.send('hello world'));
app.use('/', auth); // will add register and signin routes
app.use('/todos', todos); // will add todos crud operations
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.log(`Running on http://localhost:${PORT}`);
});