-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathserver.js
28 lines (23 loc) · 882 Bytes
/
server.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
26
27
28
/**
* This module is the entry point of Express.
*/
import express from 'express';
import compression from 'compression';
import {routesForChunking} from './routesForChunking';
import {routesForNonChunking} from './routesForNonChunking';
import path from 'path';
const port = process.env.PORT || 8080 ,
server = express();
//Compressing the data before sending it back to client.
server.use(compression());
server.use(express.static('./public'));
//Defining Routes
//Route for Home page
server.get("/",(req,res) => res.sendFile(path.join(__dirname + '/index.html')));
//Route for Page with the chunking concept implemented.
server.get("/chunking",routesForChunking());
//Route for the page without chunking concept implemented.
server.get("/nonChunking",routesForNonChunking());
server.listen(port,()=>{
console.log("express server is listing on configured port "+port);
});