我正在使用IBM Bluemix为学校项目制作Web服务.
我的项目需要从API请求JSON,因此我可以使用它提供的数据.我使用该http get方法的数据集,我不知道它是否正常工作.
当我运行我的代码时,我收到消息:
错误:不支持协议"https:".预计"http:"
是什么导致它,我该如何解决?
这是我的.js档案:
// Hello.
//
// This is JSHint, a tool that helps to detect errors and potential
// problems in your JavaScript code.
//
// To start, simply enter some JavaScript anywhere on this page. Your
// report will appear on the right side.
//
// Additionally, you can toggle specific options in the Configure
// menu.
function main() {
return 'Hello, World!';
}
main();/*eslint-env node*/
//------------------------------------------------------------------------------
// node.js …Run Code Online (Sandbox Code Playgroud) 当我尝试运行我的 node.js 代码时,我在 Windows 10 命令提示符中收到“res.render 不是函数错误”。
是什么导致了这个错误,我该如何摆脱它?
这是我的 .js 文件:
/*eslint-env node*/
//------------------------------------------------------------------------------
// node.js starter application for Bluemix
//------------------------------------------------------------------------------
// HTTP request - duas alternativas
var http = require('http');
var request = require('request');
// cfenv provides access to your Cloud Foundry environment
// for more info, see: https://www.npmjs.com/package/cfenv
var cfenv = require('cfenv');
//chama o express, que abre o servidor
var express = require('express');
// create a new express server
var app = express();
// serve the files out …Run Code Online (Sandbox Code Playgroud)