How can I create a Restful API with Javascript only. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

10th May 2019, 12:21 PM
Isaac Munyaradzi Machakata
Isaac Munyaradzi Machakata - avatar
5 Answers
+ 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.
10th May 2019, 2:07 PM
Daniel Adam
Daniel Adam - avatar
+ 1
HTTP and JSON are obviously good choices for implementing your API, but not required to build an RESTful Application.
10th May 2019, 2:09 PM
Daniel Adam
Daniel Adam - avatar
10th May 2019, 2:13 PM
Isaac Munyaradzi Machakata
Isaac Munyaradzi Machakata - avatar
0
So what can I use
10th May 2019, 2:13 PM
Isaac Munyaradzi Machakata
Isaac Munyaradzi Machakata - avatar
- 1
Angular, Knockout, Swing, or any other stack you like.
10th May 2019, 2:14 PM
Daniel Adam
Daniel Adam - avatar