Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
It depends. If you are referring to the backend and the creation of the API itself, than it is basically a service, ran on a server (Similar to a Website) that receives a request, processes it somehow (ie Database, Calculations, etc) and returns a response to the client. An example of an API written in JavaScript with Node and Express.js: const express = require('express'); const app = express(); app.get('/', function(req, res) { res.send("Let's Play Some Fortnite"); }); app.listen(8080); —————— If you are referring to the front end and the actual usage of an API, then you would do so in Javascript by calling the API through an http request of sorts and doing something with the returned data: fetch("api.somewhere.com") .then(res => console.log(res)); I hope that helps. Please ask for any other questions.
3rd Jan 2020, 11:47 PM
SuperC
SuperC - avatar
+ 1
in Java, API can refers to standard library too. import java.util.Arrays; //.. int[] a = {1,2,3}; System.out.println( Arrays.toString(a) ); https://docs.oracle.com/en/java/javase/13/docs/api/
4th Jan 2020, 12:30 AM
zemiak