API, whatever API - Model functional services with dedicated interface - Can use several other services for data aggregation - Secured by tokens - Consumable by every client which speaks HTTP(S) 11
◦ Like Apps we use every single day ◦ Single-Page-Applications (Angular 2, React) • Only data is needed after initial loading • Flexible hosting environments ◦ Azure ◦ Heroku ◦ Digital Ocean 12
data from the web server ◦ PUT: update data on the web server ◦ POST: create data on the web server ◦ DELETE: delete data on the web server • HTTP web server • Uniform Resource Locator (URL) That’s all we need. 13
data. GET gets the blog article with id 11 PUT updates the blog article with id 11 DELETE deletes the blog article with id 11 POST creates a blog article (in this case the web server creates the id) 14
• DELETE /api/user - deletes all users Possibility to define filters, orders, paging with query parameters: • GET /api/blog?search=cat - get all blog articles with its content “cat” • GET /api/blog?orderBy=date&direction=desc - get all blog articles ordered by date descending • GET /api/blog?page=3 - gets the third page Web APIs - Interface 15
‘myServer’ ); // For parsing the body automatically to a nice JSON object server.use(restify.bodyParser()); server.listen(1337, () => { console.log(`${server.name} is listening at ${server.url}`); }); 19
Restify: http://restify.com • Web API basics: https://manuel-rauber.com/2016/03/07/node-js-asp-net-core-1-0-a-usage- comparison/ • CORS: https://manuel-rauber.com/2016/03/29/node-js-asp-net-core-1-0-a-usage-comparison-part-4- cross-origin-resource-sharing/ • Sample Web API - Star Wars: https://swapi.co/