This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
export default() => { | |
return axios.create({ | |
baseURL: 'https://api.github.com/' | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Api from '@/services/Api' | |
export default { | |
searchUser (params) { | |
return Api().get('users/' + params.username); | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import Router from 'vue-router' | |
import Home from '@/components/Home' | |
Vue.use(Router) | |
export default new Router({ | |
routes: [ | |
{ | |
path: '/', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="hello"> | |
<h1>{{ msg }}</h1> | |
<input type="text" name="username" v-model="username"/> <br> | |
<button @click="getUserData"> Search </button> | |
<div v-if="user !== null" class="profile"> | |
<img v-bind:src="user.avatar_url" width="200" height="200"> <br> | |
<label>Username : {{ user.login }}</label> <br> | |
<label>Profile name : {{ user.name }}</label> <br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"login": "ecojuntak", | |
"id": 9149602, | |
"avatar_url": "https://avatars1.githubusercontent.com/u/9149602?v=4", | |
"gravatar_id": "", | |
"url": "https://api.github.com/users/ecojuntak", | |
"html_url": "https://github.com/ecojuntak", | |
"followers_url": "https://api.github.com/users/ecojuntak/followers", | |
"following_url": "https://api.github.com/users/ecojuntak/following{/other_user}", | |
"gists_url": "https://api.github.com/users/ecojuntak/gists{/gist_id}", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var path = require('path'); | |
var serveStatic = require('serve-static'); | |
app = express(); | |
app.use(serveStatic(__dirname + "/dist")); | |
var port = process.env.PORT || 5000; | |
app.listen(port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var app = express(); | |
var router = require('./routers/router') | |
var bodyParser = require('body-parser'); | |
app.use(bodyParser.json()) | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.get('/', (req, res) => { | |
res.send("Simple API Gateway") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
module.exports = (baseURL) => { | |
return axios.create({ | |
baseURL: baseURL, | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var router = express.Router() | |
const apiAdapter = require('./apiAdapter') | |
const BASE_URL = 'http://localhost:8000' | |
const api = apiAdapter(BASE_URL) | |
router.get('/feeds', (req, res) => { | |
api.get(req.path).then(resp => { | |
res.send(resp.data) |
OlderNewer