Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js &引用;无法获取/quot;使用nodejs+;拉维尔_Node.js_Laravel - Fatal编程技术网

Node.js &引用;无法获取/quot;使用nodejs+;拉维尔

Node.js &引用;无法获取/quot;使用nodejs+;拉维尔,node.js,laravel,Node.js,Laravel,我正在使用带有nodejs和几个npm的Laravel 在我的server.js中,我有这段代码,控制台中没有显示错误,只有我的“服务器在端口3000侦听”消息,但是,我一直收到“Cannot GET/” 找不到我的代码有什么问题,请帮助 var socket = require( './public/node_modules/socket.io' ); var express = require('./public/node_modules/express'); var app =

我正在使用带有nodejs和几个npm的Laravel

在我的server.js中,我有这段代码,控制台中没有显示错误,只有我的“服务器在端口3000侦听”消息,但是,我一直收到“Cannot GET/”

找不到我的代码有什么问题,请帮助

var socket  = require( './public/node_modules/socket.io' );
var express = require('./public/node_modules/express');
var app     = express();
var server  = require('http').createServer(app);
var io      = socket.listen( server );
var port    = process.env.PORT || 3000;

server.listen(port, function () {
  console.log('Server listening at port %d', port);
});


io.on('connection', function (socket) {

  socket.on( 'new_count_message', function( data ) {
    io.sockets.emit( 'new_count_message', { 
        new_count_message: data.new_count_message

    });
  });

  socket.on( 'update_count_message', function( data ) {
    io.sockets.emit( 'update_count_message', {
        update_count_message: data.update_count_message 
    });
  });

  socket.on( 'new_message', function( data ) {
    io.sockets.emit( 'new_message', {
        name: data.name,
        email: data.email,
        subject: data.subject,
        created_at: data.created_at,
        id: data.id
    });
  });


});
以下是我的路线:

Route::get('/', function () {
    return view('send');
});
Route::post('/','SendController@postCreate');
Route::get('message','MessageController@index');
Route::post('message','MessageController@updateSeen');

我的send.blade.php文件是一个简单的静态页面。

确定。您的服务器正在侦听,但似乎由于您没有为应用程序var分配任何内容(没有路由,没有静态文件服务中间件等),一旦请求传入,就没有人在为其服务


端口已打开并正在侦听,但没有人应答

您似乎只在运行nodejs服务器,您确定您也在运行laravel服务器吗


保持您的端口不变,并检查端口80中的laravel应用程序。

与server.js交互的php部分在哪里?您一直在哪里获取
无法获取/
?当转到@ZakariaAcharki时,我获取“无法获取/”。这与message.blade.php文件相互作用。它是,请看第四行:var server=require('http')。createServer(应用程序),我更新了问题。@bob xplosion抱歉,第一次没有理解整个环境