node.js - i am trying to give an "hello world" in client side browser with express and http.? -
here code app.js
var express = require('express'); var app = express(); var http = require('http').server(app); app.use(express.static('public')); app.get("/send", function (request, response) { response.sendfile('index.html', {root : './views'}); }); var listener = http.listen(process.env.hostname || 'myhostname.com/nodejs/restapi' ,function(){ console.log('server running'); });
and views/index.html
<script src="../client.js" type="text/javascript"> </script>
and public/client.js
$(function() { $.get('/nodejs/restapi/send', function(send) { console.log('hello world :o'); }); });
i dont know whats wrong working in localhost
Comments
Post a Comment