[英]nodemon app crashed - waiting for file changes before starting… nodejs
[英]Nodejs, nodemon app crashed (screenshot inside)
似乎您正在使用 https 連接而不處理 TLS 證書傳遞。
這是一個代碼片段,使您無需配置證書即可訪問 openweathermap API。
const express = require('express')
const https = require('https')
const app = express()
app.get("/", function(req, res) {
const url = "<openweathermap>"
var options = require('url').parse( /**String*/ url );
options.rejectUnauthorized = false;
https.get(options, function(response) {
console.log(response);
}).on( 'error',function ( e ) {
console.log(err);
}).end();
res.send("Sever up and running");
}
app.listen(3000, function(){
console.log("Server running on port 3000";
}
我建議閱讀有關如何在 Node.JS 中為 HTTPS 設置證書的更多信息,請參閱此文檔。 更多細節。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.