+ 1
How can I create a Restful API with Javascript only.
I want to create an api like program where I can POST, or GET data to & from a json data on the server.
5 Antworten
+ 1
You mix up terms. API is an application interface. A program might implement such an interface. Programs always have a state, where and API allows you to do state transitions. Thus are made via messages, and POST, GET are such messages, provided by HTTP, that is an communication protocol. JSON is a notation that is used for messages, often transfered via HTTP, between client and server over network. REST API's are implementations of an API that follow REST principles. REST is an architecture principle that guarantees scalability of your API, cause it follows HATEOAS (hypertext as the engine of application state). This is important, cause todays web applications usually are orchestrations of services (for reuse). Services are independent, and stateless (for scalability reasons), so they don't share a state (as I already said: applications always have a state). So following REST for interfaces means building scalable API, allows reusing stateless services, thus resulting in a new scalable application. Done.
+ 1
HTTP and JSON are obviously good choices for implementing your API, but not required to build an RESTful Application.
+ 1
I found this on stackoverflow https://stackoverflow.com/questions/36975619/how-to-call-a-rest-web-service-api-from-javascript
0
So what can I use
- 1
Angular, Knockout, Swing, or any other stack you like.