Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9004e35

Browse files
committed
setup server api
1 parent14f33c9 commit9004e35

File tree

6 files changed

+70
-3
lines changed

6 files changed

+70
-3
lines changed

‎.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_URL=http://localhost:3000/graphql

‎package-lock.json

Lines changed: 36 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"test":"npm run build && node ./node_modules/vscode/bin/test"
5353
},
5454
"devDependencies": {
55+
"@types/dotenv":"^6.1.1",
5556
"@types/mocha":"^5.2.7",
5657
"@types/node":"^12.7.1",
5758
"concurrently":"^4.1.1",
@@ -61,6 +62,8 @@
6162
"typescript":"^3.5.3"
6263
},
6364
"dependencies": {
65+
"axios":"^0.19.0",
66+
"dotenv":"^8.0.0",
6467
"vscode":"^1.1.36",
6568
"xstate":"^4.6.7"
6669
},

‎src/services/api/api.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
importaxiosfrom'axios'
2+
3+
require('dotenv').config()
4+
5+
constapi=axios.create({
6+
baseURL:process.env.API_URL,
7+
method:'POST',
8+
headers:{
9+
'Content-Type':'application/graphql',
10+
}
11+
})
12+
13+
exportdefaultapi
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
querygetTutorial($tutorialId:ID!) {
2+
tutorial(id:$tutorialId) {
3+
id
4+
testRunner
5+
codingLanguage
6+
repo {
7+
uri
8+
branch
9+
}
10+
latestVersion {
11+
version
12+
coderoadVersion
13+
data
14+
}
15+
}
16+
}

‎src/services/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const tutorialsData: { [key: string]: CR.Tutorial } = {
1212
[basicTutorial.id]:basicTutorial,
1313
}
1414

15-
// TODO: replace with fetch resource
15+
// TODO: replace with fetch resource in ./api.ts
1616
exportdefaultasyncfunctionfetch(options:Options):Promise<any>{
1717
switch(options.resource){
1818
case'getTutorialsSummary':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp