-
Notifications
You must be signed in to change notification settings - Fork 2
How to make an API request
Stephen Morrison edited this page Feb 26, 2016
·
1 revision
req.App.api.method(endpoint, data, (err, statusCode, body) => {
// send response here stuff here
});
Example get request with no query parameters to /login
req.App.api.get('/login', (err, statusCode, body) => {
// send response here stuff here
});
Example get request with query parameters
req.App.api.get('/login', {name: 'John'}, (err, statusCode, body) => {
// send response here stuff here
});
Example post request to '/login' with no body
req.App.api.post('/login', (err, statusCode, body) => {
// send response here stuff here
});
Example post request with a body
req.App.api.post('/login', {name: 'John'}, (err, statusCode, body) => {
// send response here stuff here
});
Example put request to '/login' with no body
req.App.api.put('/login', (err, statusCode, body) => {
// send response here stuff here
});
Example put request with a body
req.App.api.put('/login', {name: 'John'}, (err, statusCode, body) => {
// send response here stuff here
});