-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (20 loc) · 733 Bytes
/
Copy pathserver.js
File metadata and controls
25 lines (20 loc) · 733 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
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const index = require('./src/server/index');
const searchTweets = require('./src/server/tweets');
const favouriteTweets = require('./src/server/db');
const port = 3000;
const app = express();
app.set('views', path.join(__dirname, './src'));
app.set('view engine', 'ejs');
app.engine('html', require('ejs').renderFile);
app.use(express.static(path.join(__dirname, 'client')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use('/', index);
app.use('/api', searchTweets);
app.use('/api', favouriteTweets)
app.listen(port, () => {
console.log('Server started on port ' + port)
})