简体   繁体   中英

How to access REST API endpoints made by ExpressJS in a C# code

I have set up a backend server with multiple endpoints using NodeJS with the ExpressJS framework. These REST Api Endpoints are connected to a Mongodb Database.

Due to project requirements, I had to write some code on C# that will also be calling and posting data into the database. However, I am now having trouble accessing the collections created by the ExpressJS Api Endpoint on my C# code.

May I know how is it normally done? Eg. how do I create a GET request from C# to access a collection created by ExpressJS Any help is greatly appreciated! Thank you!

I am not sure what you are really looking for...
But for that you will need your express server running/online, so you may consume the api you have set it up.
And for C# part, you will need to do something that C# will hit/consume the endpoints from express server.

I think this links will be very helpful, I hope to be of a help for you.
How do I make calls to a REST api using C#?

https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client#send-a-get-request-to-retrieve-a-resource

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM