2017-10-07 149 views
0

因此,我用java創建了應用程序,該應用程序使用mongo java驅動程序將數據發送到我的服務器,但我需要一種方法將這些數據存入我用nodejs expressjs製作的儀表板中。 Mongoose支持獲取外部數據?Mongoose從遠程服務器獲取外部數據

回答

1

有許多方法可以將mongoDB引入使用nodejs和expressjs創建的儀表板應用程序中。我給出了以下兩種方法,選擇最適合你的方法。

方法1:

1)創建並在Java應用程序,它連接到MongdDB

2)在你的Dashboard應用程序

閱讀消費REST服務公開REST服務通過這些參考資料獲取更多關於如何在節點j中使用REST服務的信息

https://isolasoftware.it/2012/05/28/call-rest-api-with-node-js/

https://www.rapiddg.com/blog/calling-rest-api-nodejs-script

http://www.dotnetcurry.com/nodejs/1225/call-external-service-using-nodejs

創建Java RESTful服務

https://www.tutorialspoint.com/restful/restful_first_application.htm

http://www.vogella.com/tutorials/REST/article.html(使用JAX-RS)

https://spring.io/guides/gs/rest-service/(使用Spring框架)

方法2:

如果使用的是貓鼬,然後用貓鼬的API,我們可以直接調用MongoDB的(不使用Java應用程序)

參考

https://www.npmjs.com/package/mongoose-restful-crud

https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4

https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd