Skip to content

Instantly share code, notes, and snippets.

@drenther drenther/apiCalls.js
Created Jun 17, 2018

Embed
What would you like to do?
All the API requests for react-ssr
import axios from 'axios';
const baseUri = 'http://localhost:3002';
export const fetchAllMovies = () =>
axios
.get(`${baseUri}/movies`)
.then(({ data }) => data)
.catch(e => {
console.log(e);
return null;
});
export const fetchMovieById = id =>
axios
.get(`${baseUri}/movie/${id}`)
.then(({ data }) => data)
.catch(e => {
console.warn(e);
return null;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.