Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = require('http')
- var fs = require('fs');
- var server = http.createServer(function(req, res) {
- var path = req.url
- if (path == "/joke") {
- var joke = "programming is easy"
- res.end(joke);
- }
- else if (path == "/anybody") {
- res.end(fs.readFileSync('./index.html'));
- }
- })
- server.listen(2000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement