Tag: localhost

如何在本地运行的Web服务之间进行通信

我有一些只能通过API网关服务器调用的后端服务。 后端服务在Spring Rest服务中,API GateWay是一个节点服务器。这两个服务器在不同的端口(后端:8080,节点:3000)本地运行。 我如何向我的节点服务器请求后端服务?

无法在Windows 10上使用docker访问localhost:8080

在我的计算机上运行我的docker-compose-development.yaml时,我无法连接到http://localhost:8080 。 另外,我可以运行docker-compose -f docker-compose-development.yaml exec web curl http://localhost:8080 ,我得到了一个结果。 所以它似乎不是一个代码问题。 我已经做了什么: 使用$ docker inspect …容器IP直接连接$ docker inspect … 试试另一台Windows 10笔记本电脑( 它的工作原理 ) 将localhost更改为127.0.0.1或0.0.0.0 尝试另一个端口比8080 这是我的$ docker version : Client: Version: 17.11.0-ce API version: 1.34 Go version: go1.8.4 Git commit: 1caf76c Built: Mon Nov 20 18:30:11 2017 OS/Arch: windows/amd64 Server: Version: 17.11.0-ce API version: 1.34 […]

Node.js在本地主机上挂起/加载

我跟随这个初学者node.js教程( http://debuggable.com/posts/understanding-node-js:4bd98440-45e4-4a9a-8ef7-0f7ecbdd56cb ),我刚刚创build了我的第一个服务器使用此代码: var http = require("http") http.createServer( function(request, response){ response.writeHead(200, {"Content-Type":"text/plain"}) response.write("hello world") response.end } ).listen(3333) 这个工程很好,但是当我去到url localhost:3333 /我很短暂地看到“hello world”这个词,然后它就消失了。 快速观看此藤蔓video: https : //vine.co/v/MBJrpBEQvLX 有任何想法吗?

mongoose.connect() – 无法传递参数

我是nodejs和mongodb的初学者。 我正在使用这个教程scotch.io来开发一个宁静的api 。 我被困在' 连接到我们的数据库 ' mongoose.connect( '的mongodb://节点:node@novus.modulusmongo.net:27017 / Iganiq8o'); 我在 – C:\ mongodb上安装了mongodb 数据目录path – C:\ Users \ mshubham \ Desktop \ Main01 \ data \ db 项目path(api) – C:\ Users \ mshubham \ Desktop \ Main01 \ testapi.js 架构path – C:\ Users \ mshubham \ Desktop \ Main01 \ app \ models 但是我不能在localhost获得api请求:8080 […]

本地主机,和映射主机在etc / hosts工作,但127.0.0.1不

伟大的神秘。 我有一个运行在OS X El Capitan上的Express / Node(v4.2.2)JS应用程序。 该应用程序运行在端口4444.如果我运行的应用程序,我能够得到正确的回应与以下命令: curl localhost:4444 – >工程 curl [::1]:4444 – >工程 curl api.q.com:4444 – >工程 不过,我有一个问题: curl 127.0.0.1:4444 – > 不起作用; 以 curl: (52) Empty reply from server 在所有浏览器中, 127.0.0.1:4444失败。 更令人惊讶的是, 除了 Chrome以外, api.q.com:4444可以在所有浏览器中使用。 我的/etc/hosts文件: 127.0.0.1 localhost web.q.com api.q.com qrm.q.com fhr.q.com ::1 localhost fe80::1%lo0 localhost 我已经尝试将我的/etc/hosts文件重置为默认值,并刷新了我的DNScaching。 我有一种感觉可能是应用程序,但我不知道是什么原因。 有什么build议么?

如何访问cloud9中的localhost:9000 for Harp服务器(自定义工作区)?

我正在尝试使用harp server my-blog运行竖琴服务器,它在localhost:9000上提供。 我如何访问Cloud9? 我已经尝试了所有可用的解决scheme在networking上 http://workspace-user.c9users.io:9000 http://workspace.user.c9users.io:9000 甚至是使用mysql-cli的7位数字都没什么用处!

使用NodeJS和ExpressJS托pipe静态渐进式Web应用程序(PWA)

我正在尝试使用ExpressJS来托pipe一个静态的渐进式Web应用程序,但由于我对web dev相当陌生,所以我遇到了一些麻烦。 我发现了许多关于如何使用ExpressJS进行路由的精彩文章(请参阅下面的链接),但没有一篇能够帮助我解决问题。 这些教程是相当基本的,我找不到任何更先进的教程 – 如果你们知道任何请回复此线程并将其链接! https://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm https://stormpath.com/blog/build-nodejs-express-stormpath-app https://zellwk.com/blog/crud-express-mongodb/ https://www.codementor.io/nodejs/tutorial/build-website-from-scratch-using-expressjs-and-bootstrap 我的文件夹结构如下所示: node_modules package.json server.js index.html sw.js (service worker) public/ js/ index.js style/ index.css 和我的server.js看起来像这样: var express = require('express'); var app = express(); // Initialize static content app.use(express.static('public')); app.get('/index.html', function(req, res) { res.sendFile(__dirname + '/index.html'); }); app.listen(8887); 在我的index.html我加载我的public / style / index.css样式表和public / js / index.js […]

使templateUrl指向一个html文件

在项目的angularApp.js中,我想用templateUrl定义一个状态。 首先,我尝试了以下内容: app.config(['$stateProvider', function ($stateProvider) { $stateProvider .state('editor', { url: …, templateUrl: '/editor.html', controller: … }) 控制台显示[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (editor.html, line 0)在http://localhost:3000/editor.html处[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (editor.html, line 0) ,而不是editor.html 。 然后,我尝试了一个相对path `templateUrl: […]

用Angular http发送Ionic请求

我有一个离子应用程序,我试图发送我的Stripe令牌,付款处理。 当我用curl发送请求到node服务器时,它正在接收请求。 但是,当我尝试通过Angular的http模块发送请求时,它根本没有注册。 所有这些目前正在本地进行testing,所以这可能是问题的一部分? HTML <button (click)="testPost()" ion-button full>TEST POST</button> cart.ts … import {Http, Headers, RequestOptions} from '@angular/http'; import { Stripe } from '@ionic-native/stripe'; @Component({ selector: 'page-cart', templateUrl: 'cart.html', }) export class Cart { constructor( … private http: Http, private stripe: Stripe ) { // }); } testPost() { var headers = new Headers(); headers.append("Accept", […]

在服务器上,端口如何在Node.js中工作?

我目前正在本地开发一个节点服务器,并访问它我有服务器在8080上侦听,然后在浏览器中去localhost:8080。 但是,当我把这个项目放到互联网上时,端口如何工作呢?