'Programming/Node.js'에 해당하는 글 1건

Node.js 를 이용하여 서버를 간단하게 생성해보도록 하겠습니다.


[testServer.js]

var http = require('http');

var express = require('express');


var app = express();

var server = http.createServer(app);


app.use(express.static(__dirname + "/index"));


app.get('/', function(req, res, err) {

res.send(200, "Success");

});


server.listen(8888, function(req, res) {

console.log("server running on 8888.");

});

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

[index.html]

<!DOCTYPE html>

<html>

<head>

<meta charset="EUC-KR">

<title>Test Page</title>

</head>

<body>

<h1>Hello, It is Test Page!</h1>

</body>

</html>


WRITTEN BY
SiriusJ

,