简体   繁体   中英

Java Android app and Node.js + Express.js API

I'm actually developing an Android Application that needs connection to the internet. In my API, I am using Node.js and Express.js to handle simple requests such as login, register, or retrieving data about other users. I am using multiple HTTP requests type with Express.js, such as POST, GET, PUT, PATCH and DELETE, depending on what the server will have to do. The server is always returning JSON to the client.

I searched on the internet but I didn't find any Framework made to perform HTTP requests from an Android Application. I know that this is possible with some native Java Objects, but I would like something simple and reliable. As I said before, I need to perform different requests (PUT, POST, GET, DELETE etc...).

I saw the OkHttp framework, but It don't seem to do exactly what I want...

The HttpURLConnection class is everything you need for that. It's not complex so you'll find your way around it pretty quick. The thing you have to think about is asynchronism. This article helps a lot.

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