Source: What Google Learned From Its Quest to Build the Perfect Team
Biggest thing: Psychological safety
Other important norms:
Source: A Conversation about REST with my brother
Ajax API to help with flexibility/readability for interacting with APIs. Works with Node.js.
Example
request
.post('/api/pet')
.send({ name: 'Manny', species: 'cat' })
.set('X-API-Key', 'foobar')
.set('Accept', 'application/json')
.then(res => {
alert('yay got ' + JSON.stringify(res.body));
});
To initiate a request:
.then()
or .end()
or await
A Simple GET:
request
.get('/search')
.then(res => {
// res.body, res.headers, res.status
})
.catch(err => {
// err.message, err.response
});
HTTP method can also be passed as a string:
request('GET', '/search').then(success, failure);
Server needs CORS
request
.get('https://example.com/search')
.then(res => {
});
request
.get('/search')
.set('API-Key', 'foobar')
.set('Accept', 'application/json')
.then(callback);
Pass in object
request
.get('/search')
.set({ 'API-Key': 'foobar', Accept: 'application/json' })
.then(callback);
.query()
accepts objects, can be used to form query-string
request
.get('/search')
.query({ query: 'Manny' })
.query({ range: '1..5' })
.query({ order: 'desc' })
.then(res => {
});
See link for full documenation