-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (21 loc) · 824 Bytes
/
index.js
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
import express from 'express';
import bodyParser from 'body-parser';
import path from 'path';
import {docRoutes} from './routes/doc-routes.js';
import {noteRoutes} from './routes/note-routes.js';
import {errorHandler} from './middlewares/error-handler.js';
import {commonHandler} from './middlewares/common-handler.js';
const app = express();
app.use(bodyParser.json());
app.use(commonHandler.doLogging());
app.use(express.static(path.resolve('public')));
app.use(express.static(path.resolve('public/html')));
app.use('/', docRoutes);
app.use('/api/notes', noteRoutes);
app.use(errorHandler.handleNotFound);
app.use(errorHandler.handleServerError);
const port = 3001;
app.listen(port, () => {
// eslint-disable-next-line no-console
console.log(`"Noting Matters" Server running at http://localhost:${port}`);
});