我正在使用用 NODE JS 编写的 azure 函数。我正在启动本地服务器
func host start
Run Code Online (Sandbox Code Playgroud)
一切正常。但问题是当我更改我的 azure 函数中的某些内容时 - 例如当我添加一个简单的控制台日志时
module.exports = async function (context, req) {
console.log('request came');
context.res = {
body: { success: true, message: null, response: context.bindings.inputDocument }
};
};
Run Code Online (Sandbox Code Playgroud)
服务器没有重新启动,我需要停止服务器再次运行 func host start 以查看更改,这不好。在nodejs中,我们有nodemon,在azure函数中是否有一些东西可以让我监视更改而无需停止并在每次更改时启动服务器?
我尝试了什么
我尝试添加我的 host.json 文件
"watchDirectories": [ "*" ]
Run Code Online (Sandbox Code Playgroud)
但没有成功。
我也尝试过
scripts编辑package.json 文件中的 start 属性
"scripts": {
"start": "start npm run watch & npm run start:host",
"test": "echo \"No tests yet...\""
},
Run Code Online (Sandbox Code Playgroud)
反而
"scripts": {
"start": "func start", …Run Code Online (Sandbox Code Playgroud) 我有以下角度的 http 拦截器
import { Injectable, Inject } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpResponse } from '@angular/common/http';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { tap } from "rxjs/operators";
import { ToastrService } from 'ngx-toastr';
import { NgxSpinnerService } from "ngx-spinner";
@Injectable()
export class AppHttpInterceptor implements HttpInterceptor {
constructor(
@Inject('API_URL') private baseUrl: string,
public router: Router,
public toasterService: ToastrService,
private spinner: NgxSpinnerService
) { }
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { …Run Code Online (Sandbox Code Playgroud)