![](/img/trans.png)
[英]Core Node.js module "fs" Not Found when @fastify/static deployed on render.com
據我了解,像“fs”這樣的核心模塊是 node.js 構建的一部分,不需要特殊配置就可以導入它們,所以我不知道“fs”是如何丟失的在 render.com 上運行。 我在本地以開發模式構建或運行沒有問題。 該服務在 render.com 上完美部署和構建,但運行失敗並顯示: 該服務一直在愉快地運行 ...
[英]Core Node.js module "fs" Not Found when @fastify/static deployed on render.com
據我了解,像“fs”這樣的核心模塊是 node.js 構建的一部分,不需要特殊配置就可以導入它們,所以我不知道“fs”是如何丟失的在 render.com 上運行。 我在本地以開發模式構建或運行沒有問題。 該服務在 render.com 上完美部署和構建,但運行失敗並顯示: 該服務一直在愉快地運行 ...
[英]Connect to Elasticsearch in a Fastify app with username and password via @fastify/elasticsearch package
我是 Fastify 的新用戶。 我通過fastify-cli創建了一個fastify@4.0.0應用程序。 我想通過用戶名和密碼連接到 Elasticsearch,但在@fastify/elasticsearch文檔中沒有提到它。 正如文檔所說: 我不知道如何設置用戶名和密碼來連接到我的 Ela ...
[英]AJV validation doesn't return multiple errors when different values are missing in the fastify request body
我有一個帶有 post 端點的 fastify 服務器。 它接受帶有驗證的 JSON 請求正文。 服務器代碼如下: 下面是一個有效的請求正文。 當我嘗試訪問缺少輸入的多個值的同一服務器時,即, 我收到以下回復。 我想分別獲取每個錯誤,而不是獲取單個大錯誤消息,因為此請求可以 go 非常大。 我嘗試了 ...
[英]node js fs create directory if not exists and file if not exists too
如果目錄不存在,我想創建目錄,然后保存從前端獲得的文件這是我的代碼,它只完成創建文件夾的部分,但我的主要問題是將文件保存在此路徑中 ...
[英]"Cannot read property 'connect' of undefined
我在 pg.connect not defined 上收到錯誤。 在處理程序模塊中。 我正在嘗試在 fastify 中使用 postgres 創建一個表。 我有並處理處理路由並發送 API 請求的路由文件夾。 當我點擊 http://localhost:3000/initDB 路由時,錯誤提示 這 ...
[英]How to enable express/fastify to support absolute paths import?
在 Next.js 中,我曾經使用import UserModel from "models/UserModel"導入 ESM 模塊,沒有任何前綴和擴展名,例如.js ,只需 參考文檔在jsconfig.json中設置相對路徑即可。 但是 express/fastify 不支持這兩個特性: 從項目 ...
[英]fastify + mongo = why nothing is stored inside database?
我正在使用 mongodb 構建一個 fastify 應用程序。我創建了這個 package.json 文件和一個運行 mongo 的腳本。 並使用npm run start-mongo我運行 mongo 暴露端口 27017。然后,...這是 fastify 部分。 獲取/書籍: 郵政/書籍 回 ...
[英]Set requestTimeout on a per route basis in Fastify
是否可以在 Fastify 中基於每個請求設置請求超時? 我可以在服務器級別設置默認請求超時(適用於所有路由)[見下文] 然而,每一次fastify-ish嘗試都不起作用不起作用 行得通,但是否有一個“fastify-ish”的解決方案? 似乎對我有用的唯一解決方案似乎有點老套,直接轉到節點 ht ...
[英]How can I serve the same route with fastify/static and a custom route based on header?
舉例來說,我有一條路線/object/:id ,我想默認使用 fastify/static 服務STATIC_FOLDER/object/<supplied id>/index.html 。 這真的很簡單,我只是用STATIC_FOLDER作為根注冊 fastify/static。 我 ...
[英]How to get the return value from the hook of fastify?
如何將參數從鈎子傳遞到 Fastify 中的請求處理程序? 例如,我想從請求中獲取 BasicAuth 掛鈎中的username 。const fastify = require('fastify')() const authenticate = {realm: 'Westeros'} fasti ...
[英]How to use Jest and Supertest with Fastify?
我正在嘗試將 Jest 和 Supertest 與 Fastify 一起使用。 我有這個測試文件。// @ts-nocheck import { FastifyInstance } from 'fastify' import request from 'supertest' import app ...
[英]How to register cookie middleware for e2e testing?? - @nestjs/testing and fastify adapter
我使用 pactum 和 jest 進行端到端測試但是在測試設置 cookies 的端點時,nest 拋出錯誤 但是如何為測試模塊注冊cookie中間件呢?? app.e2e-spec.ts ...
[英]how to node js write file not error name file?
我嘗試通過 nodejs 寫入文件: enter code here fs.writeFileSync(fileName, file.data, "UTF-8"); 如果 fileName 是“abc”,它就起作用了。 但是如果 fileName = '훌쩍 커버렸어',它不能保存文件。 好像是 ...
[英]How to use fastify-cors and node JS to allow multiple urls in cors origin
我的 URL 列表如下所示 我的 cors 設置如下所示: ...
[英]how to relational data one-to-one and many-to-many in sequalize in model same?
我在使用關系 sequelize 的 findById 數據中遇到問題。 我有一對一和多對多關系的條件 TB_User 與 tb_corporate 一對一相關 TB_User 與 TB Corporate 存在多對多關系,此數據關系保存在 TB_corporate_Group 中我的問題是,當我 ...
[英]fastify does not work on android emulator
我嘗試將 fastify 與 android emu 一起使用,但無法通過瀏覽器的 GET 請求訪問它。 我也試過 express,效果很好。 我有點困惑為什么 express 有效而 fastify 無效。 請幫忙。 ...
[英]Jest test fail: "● default root route"
我正在嘗試為 Fastify 項目編寫 Jest 測試。 但是我堅持使用示例代碼失敗並出現模棱兩可的錯誤:“●默認根路由”。 我究竟做錯了什么? ...
[英]Fastify: How to wait for Redis pub/sub message before sending response?
我有一條路線需要等待 Redis 發布/訂閱消息才能發送響應。 由於ioredis.on()不返回Promise ,我不能使用await來阻止。 我該怎么做才能使代碼“等待”Redis 消息? ...
[英]Can't reach nested function from another file in javascript
我正在嘗試使用 nodejs&fastify 制作分層架構。 我只是嘗試創建一個依賴於 UserRepository 的 controller,然后我嘗試將這個 controller 注入到路由文件中,就像這樣: 但是我從來沒有從路由器到達 getUserOne function,我也在 ...
[英]What to do with setTimeout on server stop or jest test end
我有一個超時,在 api 請求POST /api/exchange-refresh-token運行查詢以延遲刪除使用的刷新令牌(需要延遲以允許在短時間內進行多次交換)。 在運行玩笑測試時,由於這個setTimeout ,我得到一個錯誤Jest did not exit one second aft ...