这是我的代码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');
});
和我的观点/ index.html
<script src="../client.js" type="text/javascript"> </script>
和我的Public / client.js
$(function() {
$.get('/Nodejs/Restapi/send', function(send) {
console.log('hello world :o');
});
});
我不知道它在localhost中完美运作是错误的