Donghoon Kim

added routing

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