- mongoDB
docker-composer up
- node.js Server
# install the packages first
yarn install
# or npm install
# tsc is executed first(If didn't execute, an error will be displayed but it does not matter)
yarn tsc
yarn dev
# or npm run dev
POST /thing/
curl -i -H 'Accept: application/json' -d 'name=Foo&status=new' http://localhost:7000/thing
HTTP/1.1 201 Created
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 201 Created
Connection: close
Content-Type: application/json
Location: /thing/1
Content-Length: 36
{"id":1,"name":"Foo","status":"new"}
GET /thing/id
curl -i -H 'Accept: application/json' http://localhost:7000/thing/1
HTTP/1.1 200 OK
Date: Thu, 24 Feb 2011 12:36:30 GMT
Status: 200 OK
Connection: close
Content-Type: application/json
Content-Length: 36
{"id":1,"name":"Foo","status":"new"}
POST /auth/signup HTTP/1.1
Host: localhost:3000
Content-Type: application/json
{
"name":"keyo",
"email": "[email protected]",
"password": "12345678",
"repassword": "12345678"
}
{
"token": "A JWT TOKEN"
}
error
{
"error": [
{
"msg": "使用者名稱不得為空",
"param": "name",
"location": "body"
},
{
"msg": "Email 不得為空",
"param": "email",
"location": "body"
},
{
"msg": "Email 格式錯誤",
"param": "email",
"location": "body"
},
{
"msg": "密碼不得為空",
"param": "password",
"location": "body"
},
{
"msg": "密碼少於8個字",
"param": "password",
"location": "body"
},
{
"msg": "請再次輸入密碼確認",
"param": "repassword",
"location": "body"
}
]
}
POST /auth/google HTTP/1.1
Host: localhost:3000
Content-Type: application/json
{
"access_token": "access_token from google"
}
{
"token": "A JWT TOKEN"
}
error
{
"error": "InternalOAuthError"
}
POST /auth/facebook HTTP/1.1
Host: localhost:3000
Content-Type: application/json
{
"access_token": "access_token from facebook"
}
{
"token": "A JWT TOKEN"
}
error
{
"error": "InternalOAuthError"
}
/src
controllers/
middleware/
models/
requests/
routes/
services/
typings/
passport.ts
app.ts
router.ts