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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -