app.js
1.06 KB
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
var http = require('http');
var fs = require('fs');
var express=require('express');
var app=express();
var jsdom = require('jsdom');
var $ = require('jquery');
const path=require('path');
app.use(express.static('public'));
app.use('/node_modules', express.static(path.join(__dirname,'/node_modules')));
app.get('/', function(req,res){
fs.readFile('index.html',function(err,data){
res.writeHead(200,{'Content-Type':'text/html'});
res.end(data);
});
});
app.get('/build/create', function(req,res){
fs.readFile('build_index.html',function(err,data){
res.writeHead(200,{'Content-Type':'text/html'});
res.end(data);
});
});
app.get('/imgs',function(req,res){
fs.readFile('logoIMG.jpg',function(err,data){
res.writeHead(200,{'Content-Type':'text/html'});
res.end(data);
});
});
app.listen(8080,function(){
console.log('Server Start.');
})
/*
http.createServer(function (req, res) {
fs.readFile('index.html', function(err, data) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write(data);
res.end();
});
}).listen(8080);
*/