草庐IT

Apollo-Client

全部标签

node.js - Node js - Socket.io-client 未连接到 socket.io 服务器

我正在尝试使用以下代码连接到socket.io-client:服务器://Loadrequirementsvarhttp=require('http'),io=require('socket.io');//Createserver&socketvarserver=http.createServer(function(req,res){//SendHTMLheadersandmessageres.writeHead(404,{'Content-Type':'text/html'});res.end('Aw,snap!404');});server.listen(8080);io=io.l

node.js - Node js - Socket.io-client 未连接到 socket.io 服务器

我正在尝试使用以下代码连接到socket.io-client:服务器://Loadrequirementsvarhttp=require('http'),io=require('socket.io');//Createserver&socketvarserver=http.createServer(function(req,res){//SendHTMLheadersandmessageres.writeHead(404,{'Content-Type':'text/html'});res.end('Aw,snap!404');});server.listen(8080);io=io.l

node.js - 将 ApolloClient 与 node.js 一起使用。 "fetch is not found globally and no fetcher passed"

我正在尝试在node.js服务器上使用Apollo客户端来使用以下代码与另一个GraphQLAPI进行交互:importfetchfrom'node-fetch'import{createHttpLink}from'apollo-link-http'importApolloClientfrom'apollo-boost'import{API_URL}from'...'constclient=newApolloClient({link:createHttpLink({uri:API_URL,fetch:fetch,}),})这会产生以下错误:moduleinitializationerr

node.js - 将 ApolloClient 与 node.js 一起使用。 "fetch is not found globally and no fetcher passed"

我正在尝试在node.js服务器上使用Apollo客户端来使用以下代码与另一个GraphQLAPI进行交互:importfetchfrom'node-fetch'import{createHttpLink}from'apollo-link-http'importApolloClientfrom'apollo-boost'import{API_URL}from'...'constclient=newApolloClient({link:createHttpLink({uri:API_URL,fetch:fetch,}),})这会产生以下错误:moduleinitializationerr

node.js - 错误 : Cannot find module 'npm-registry-client'

每当我尝试安装npm-registry-client时,都会收到错误“错误:找不到模块'npm-registry-client'”。我已尝试使用以下命令解决此问题,但这不起作用:npm卸载npminstall-gnpm@latest完整的输出是:user@pc~/devel>npminstallnpm-registry-client--savemodule.js:340throwerr;^Error:Cannotfindmodule'npm-registry-client'atFunction.Module._resolveFilename(module.js:338:15)atFun

node.js - 错误 : Cannot find module 'npm-registry-client'

每当我尝试安装npm-registry-client时,都会收到错误“错误:找不到模块'npm-registry-client'”。我已尝试使用以下命令解决此问题,但这不起作用:npm卸载npminstall-gnpm@latest完整的输出是:user@pc~/devel>npminstallnpm-registry-client--savemodule.js:340throwerr;^Error:Cannotfindmodule'npm-registry-client'atFunction.Module._resolveFilename(module.js:338:15)atFun

Node.js socket.io-client connect_failed/connect_error 事件

我在玩node.js和socket.io-client。我正在尝试连接到不存在的channel以触发事件“connect_failed”(在https://github.com/LearnBoost/socket.io-client中指定)。但是我无法让事件正常进行:varclientio=require('socket.io-client');console.log('Tryingstuff...');//thechanneldoesnotexistvarsocket=clientio.connect('http://localhost:4000/news');//Iexpectth

Node.js socket.io-client connect_failed/connect_error 事件

我在玩node.js和socket.io-client。我正在尝试连接到不存在的channel以触发事件“connect_failed”(在https://github.com/LearnBoost/socket.io-client中指定)。但是我无法让事件正常进行:varclientio=require('socket.io-client');console.log('Tryingstuff...');//thechanneldoesnotexistvarsocket=clientio.connect('http://localhost:4000/news');//Iexpectth

javascript - 带有 Express : Importing client-side javascript using script tags in Jade views? 的 Node.js

我有一个使用Jade模板引擎运行的node.jsexpress服务器。我有一个布局文件,它可以像这样导入单个View的主体:!!!htmlheadtitle=title||'Titlenotset.'body#headerh1Header.#content!=body//-thisrendersthebodyofanindividualview#footerpFooter.例如以下索引页面:pWelcometothefrontpage.pThispageservesasanow.jstest.这很好用。但是,我现在想包含两个专门用于该索引页面的客户端javascript库(因此不是每个

javascript - 带有 Express : Importing client-side javascript using script tags in Jade views? 的 Node.js

我有一个使用Jade模板引擎运行的node.jsexpress服务器。我有一个布局文件,它可以像这样导入单个View的主体:!!!htmlheadtitle=title||'Titlenotset.'body#headerh1Header.#content!=body//-thisrendersthebodyofanindividualview#footerpFooter.例如以下索引页面:pWelcometothefrontpage.pThispageservesasanow.jstest.这很好用。但是,我现在想包含两个专门用于该索引页面的客户端javascript库(因此不是每个