<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>@muze-nl/metro-api :: MetroJS</title><link>https://metro.muze.nl/packages/metro-api/index.html</link><description>@muze-nl/metro-api npm install @muze-nl/metro-api import { jsonApi } from '@muze-nl/metro-api' const posts = jsonApi('https://jsonplaceholder.typicode.com/', { getPost(id) { return this.get(`/posts/${id}`) }, listComments(postId) { return this.get(`/comments?postId=${encodeURIComponent(postId)}`) } }) console.log(await posts.getPost(1)) Use this package when an application has a small named API surface and you do not want to pass URLs around everywhere. @muze-nl/metro re-exports these helpers as metro.api() and metro.jsonApi().
Reference See reference.</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://metro.muze.nl/packages/metro-api/index.xml" rel="self" type="application/rss+xml"/><item><title>@muze-nl/metro-api</title><link>https://metro.muze.nl/packages/metro-api/readme/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://metro.muze.nl/packages/metro-api/readme/index.html</guid><description>@muze-nl/metro-api npm install @muze-nl/metro-api import { jsonApi } from '@muze-nl/metro-api' const posts = jsonApi('https://jsonplaceholder.typicode.com/', { getPost(id) { return this.get(`/posts/${id}`) }, listComments(postId) { return this.get(`/comments?postId=${encodeURIComponent(postId)}`) } }) console.log(await posts.getPost(1)) Use this package when an application has a small named API surface and you do not want to pass URLs around everywhere. @muze-nl/metro re-exports these helpers as metro.api() and metro.jsonApi().
Reference See reference.</description></item><item><title>Reference</title><link>https://metro.muze.nl/packages/metro-api/reference/index.html</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://metro.muze.nl/packages/metro-api/reference/index.html</guid><description>@muze-nl/metro-api reference import { API, JsonAPI, api, jsonApi } from '@muze-nl/metro-api' api(base, methods) const service = api('https://example.com/api/', { getUser(id) { return this.get(`/users/${id}`) } }) Creates an API instance. base may be a Metro client or any option accepted by metro-core’s client(). methods is an object whose functions are bound to the API instance, so use normal function syntax rather than arrow functions when you need this.get(), this.post(), and friends.</description></item></channel></rss>