Skip to content

Commit

Permalink
33.웹앱-글생성 - 파일생성과 리다이렉션
Browse files Browse the repository at this point in the history
  • Loading branch information
egoing committed Jun 3, 2018
1 parent ab13376 commit 8996a04
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,15 @@ var app = http.createServer(function(request,response){
request.on('end', function(){
var post = qs.parse(body);
var title = post.title;
var description = post.description
var description = post.description;
fs.writeFile(`data/${title}`, description, 'utf8', function(err){
response.writeHead(302, {Location: `/?id=${title}`});
response.end();
})
});
response.writeHead(200);
response.end('success');
} else {
response.writeHead(404);
response.end('Not found');
}



});
app.listen(3000);

0 comments on commit 8996a04

Please sign in to comment.