add api with example usage

dev
Alfred Melch 5 years ago
parent 3c0d84c628
commit 9f14b74575

@ -0,0 +1,7 @@
import Axios from 'axios'
export function getMap(x, y) {
return Axios.get(`http://169.254.61.222:5000/generate/${x}/${y}`).then(
data => data.data
)
}

@ -4,6 +4,7 @@ import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { App } from './App' import { App } from './App'
import { getMap } from './api'
function createRootElement() { function createRootElement() {
const body = document.getElementsByTagName('body')[0] const body = document.getElementsByTagName('body')[0]
@ -13,3 +14,7 @@ function createRootElement() {
return root return root
} }
ReactDOM.render(<App />, createRootElement()) ReactDOM.render(<App />, createRootElement())
getMap(10, 20).then(map => {
console.log(map)
})

Loading…
Cancel
Save