Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Apipie from 'apipie';
- // @flow
- import axios from 'axios';
- axios.defaults.baseURL = 'http://sdm.ispaceup.com:8000';
- type withData = boolean;
- type withQuery = boolean;
- // type requireAuth = boolean;
- // const data: withData = true;
- // const params: withQuery = true;
- // const auth: requireAuth = true;
- type httpMethod = 'get' | 'delete' | 'head' | 'post' | 'options' | 'put' | 'patch';
- type Route = {
- name: string,
- method?: httpMethod,
- url?: string,
- meta?: {},
- data?: withData,
- params?: withQuery,
- children?: Route[],
- options?: {},
- }
- const routes: Route[] = [
- {
- name: 'auth',
- children: [
- {
- name: 'getLink',
- url: '/auth/login/',
- method: 'get',
- auth: true,
- },
- ],
- },
- ];
- const apipie = new Apipie(routes, { axios });
- const api = apipie.create();
- export default api;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement