-
Notifications
You must be signed in to change notification settings - Fork 41
/
server.js
51 lines (35 loc) · 1.4 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
50
51
'use strict';
const express = require('express');
const path = require('path');
const app = express();
const PORT = 3000;
//this isn't working for some reason. too lazy to solve right now so did direct request below.
app.use(express.static(path.join(__dirname, 'dejavue')));
app.use(express.static(path.join(__dirname, 'assets')));
app.use(express.static(path.join(__dirname, 'node_modules')));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname, 'dejavue/app/index.html'));
});
app.get('/dejavue/assets/js/vue.js', function(req, res) {
res.sendFile(path.join(__dirname, '/dejavue/assets/js/vue.js'));
});
app.listen(PORT, function () {
console.log("...listening on port", PORT);
});
function createDV() {
// gets document.body's child nodes which are direct child html elements
const keysArray = Object.keys(document.body.children);
// initialize empty array to store root node objects
const rootNodes = [];
function findRoots() {
// iterate through keysArray to push only Vue root nodes into rootNodes array
for (let i = 0; i < keysArray.length; i += 1) {
const testNode = document.body.children[keysArray[i]];
if (!rootNodes.includes(testNode) && `testNode.__vue__`) rootNodes.push(testNode);
}
return rootNodes;
};
const roots = findRoots();
console.log('rootNodes', rootNodes);
}
// console.log(createDV());