-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
24 lines (18 loc) · 643 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
const express = require('express');
const compression = require('compression');
const path = require('path');
const app = new express();
const { getAnimalsImages } = require('./serverSide/routing');
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
next();
});
app.use(express.static('public'));
app.get('/', (req, res) => {
console.log(__dirname + '/index.html');
res.sendFile(__dirname + '/public/index.html');
});
app.get('/animals', compression(), getAnimalsImages);
app.listen(process.env.PORT || 3000, () => {
console.log("Application started at 3000 port")
})