Donghoon Kim

added routing

Showing 1 changed file with 11 additions and 2 deletions
1 var express = require('express'); 1 var express = require('express');
2 -var router = require('./routes/index');
3 var app = express(); 2 var app = express();
3 +var fs = require('fs')
4 4
5 -app.use('/', router); 5 +app.use('/',(req, res) => {
6 + res.writeHead(200, {'Content-Type':'text/html'})
7 + fs.readFile(__dirname+'/public/index.html', (err,data)=>{
8 + if (err) {
9 + console.error(err)
10 + return res.status(500).json(err)
11 + }
12 + else res.end(data, 'utf-8')
13 + })
14 +})
6 15
7 var server = app.listen(3000); 16 var server = app.listen(3000);
......