-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from danmooozi/develop
기본작업 추가
- Loading branch information
Showing
14 changed files
with
100 additions
and
52 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
SERVER_PORT= | ||
CLIENT_ID= | ||
CLIENT_SECRET= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
trailingComma: "es5" | ||
tabWidth: 2 | ||
semi: true | ||
singleQuote: true | ||
trailingComma: "all" | ||
printWidth: 80 |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<html> | ||
<body> | ||
<button type="button" id="github-button">github-button</button> | ||
</body> | ||
|
||
<script> | ||
const button = document.querySelector('#github-button'); | ||
button.addEventListener('click', (e) => { | ||
e.preventDefault(); | ||
const scope = 'public_repo'; | ||
const redirect_uri = 'http://localhost:3000/api/v1/callback'; | ||
const client_id = '992209430f73ccf5eaf1'; | ||
|
||
const url = `https://github.com/login/oauth/authorize?scope=${scope}&redirect_uri=${redirect_uri}&client_id=${client_id}`; | ||
console.log(url); | ||
window.location.href = url; | ||
}); | ||
</script> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import express from 'express'; | ||
import testRouter from './test'; | ||
import v1Router from './v1'; | ||
import v2Router from './v2'; | ||
|
||
const router = express.Router(); | ||
|
||
router.use('/test', testRouter); | ||
router.use('/v1', v1Router); | ||
router.use('/v2', v2Router); | ||
|
||
export default router; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import express from 'express'; | ||
import axios from 'axios'; | ||
|
||
const router = express.Router(); | ||
|
||
router.get('/callback', async (req, res) => { | ||
const { code } = req.query; | ||
|
||
const result = await axios({ | ||
method: 'post', | ||
url: `https://github.com/login/oauth/access_token`, | ||
headers: { | ||
accept: 'application/json', | ||
}, | ||
data: { | ||
client_id: Bun.env.CLIENT_ID, | ||
client_secret: Bun.env.CLIENT_SECRET, | ||
code, | ||
}, | ||
}); | ||
console.log(result.data); | ||
if (result.data.error) { | ||
console.log(result.data.error); | ||
res.json(false); | ||
return; | ||
} | ||
res.json(true); | ||
}); | ||
|
||
router.get('data', async (req, res) => { | ||
const starCount = 55; // number | ||
const followerCount = 123; // number | ||
const followingCount = 223; // number | ||
const mostUsedLanguage = ['JavaScript', 'TypeScript', 'Python']; // string[] | ||
const moreThan = 'high'; // high, middle, low | ||
const commitCount = 1234; // number | ||
const commitDate = '월요일'; // 월요일, 화요일, 수요일, 목요일, 금요일, 토요일, 일요일 | ||
const mostCommunication = { | ||
// 여기 줄때 github profile 주소도 주면 좋지 않을까 ? | ||
name: 'bsy1141', // string | ||
image: 'https://avatars.githubusercontent.com/u/60652298?v=4', // string | ||
}; | ||
|
||
res.json({ | ||
starCount, | ||
followerCount, | ||
followingCount, | ||
mostUsedLanguage, | ||
moreThan, | ||
commitCount, | ||
commitDate, | ||
mostCommunication, | ||
}); | ||
}); | ||
|
||
export default router; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @swagger | ||
* tags: | ||
* - name: test | ||
* description: test api doc | ||
* @swagger | ||
* /api/v1/callback: | ||
* get: | ||
*/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import express from 'express'; | ||
|
||
const router = express.Router(); | ||
|
File renamed without changes.