-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathserver.js
49 lines (41 loc) · 1.95 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Project Name: ha-cunkute
* Description: Home Assistant with WebSocket by Keite Tran
* Creator: Tran Ngoc Anh - VietVbb Team (Keite)
* Email: [email protected]
* HomePage: https://facebook.com/mr.ngocanhtran
*/
// Setup app icon
// -------------------------------------
const express = require("express");
const path = require('path');
const app = express();
// Setup app icon
// -------------------------------------
app.set('views', path.join(__dirname, 'dist'));
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'ejs');
// Setup app icon
// -------------------------------------
app.use('/favicon.ico', express.static(path.join(__dirname, 'dist/favicon.ico')));
app.use('/manifest.json', express.static(path.join(__dirname, 'dist/manifest.json')));
app.use('/android-touch-icon-192x192.png', express.static(path.join(__dirname, 'dist/android-touch-icon-192x192.png')));
// Apple devices
// -------------------------------------
app.use('/apple-touch-icon.png', express.static(path.join(__dirname, 'dist/apple-touch-icon.png')));
app.use('/apple-touch-icon-152x152.png', express.static(path.join(__dirname, 'dist/apple-touch-icon-152x152.png')));
app.use('/apple-touch-icon-167x167.png', express.static(path.join(__dirname, 'dist/apple-touch-icon-167x167.png')));
app.use('/apple-touch-icon-180x180.png', express.static(path.join(__dirname, 'dist/apple-touch-icon-180x180.png')));
app.use('/apple-touch-startup-image-750×1294.png', express.static(path.join(__dirname, 'dist/apple-touch-startup-image-750×1294.png')));
// Public assets folder
// -------------------------------------
app.use('/assets', express.static(path.join(__dirname, 'dist/assets')));
//It will find and locate index.html from View or Scripts
// -------------------------------------
app.get('/', function (req, res) {
res.render('./index.html');
});
// Setup port running
// -------------------------------------
app.listen(3001);
console.log("Running at Port 3001");