我已经克隆了这个项目https://github.com/LaurenceHo/react-weather-app#webpack-reactjs-and-typescript
我正确地执行了所有步骤,我在Map Forecast API中的https://api.windy.com/keys中创建了新的密钥,并在此处将其作为指示放置https://github.com/LaurenceHo/react-weather-app /blob/master/src/views/weather-map.tsx
现在我运行服务器,并且此方法出现此错误 getWeather
我在网络和控制台中查找,这些是我可以看到的错误,但我不知道如何解决它
这是带有方法的api
export const getWeatherByTime = (
latitude: number,
longitude: number,
time: number,
exclude: string,
units: string
): Promise<Forecast> => {
const requestUrl =
`${CLOUD_FUNCTION_URL}getWeather?lat=${latitude}&lon=${longitude}&time=${time}` +
`&exclude=${encodeURIComponent(exclude)}&units=${encodeURIComponent(units)}`;
return fetch(requestUrl)
.then(checkStatus)
.then(parseJSON)
.then((data: any) => data);
};
我该如何解决问题?我该如何解决?
您克隆的GitHub项目在README.md
文件中对此表示:
因为我们不想在进行本地开发时使用Google Cloud Function,所以我们编写了简单的NodeJs Express服务器来返回JSON响应。移至dev-server文件夹
cd dev-server
,然后运行npm i
以安装npm模块。之后,运行npm start
以启动NodeJs Express Server,我们可以继续进行前端开发。
移至该dev-server
文件夹,然后npm start
在安装npm软件包后执行操作-似乎将在端口3000上启动开发服务器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句