This repository was archived by the owner on May 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040</a >
4141```
4242
43+ ### API
44+ /api/user/* username* /
45+ /api/repo/* username* /* repo* /
46+
4347### 🍎 Build Your Own Server | 搭建自己的服务器
4448#### 🍒 Initialization | 初始化
4549``` shell
46- npm install
50+ pnpm install
4751```
4852
4953#### 🍬 Configuration | 配置
Original file line number Diff line number Diff line change @@ -37,6 +37,22 @@ export function createServer(): void {
3737 }
3838 } ) ;
3939
40+ app . get ( '/api/user/:user/' , async function ( req : any , res : any ) {
41+ const username : string = req . params [ 'user' ] ;
42+
43+ try {
44+ if ( ! await isAuthenticated ( username ) ) {
45+ res . send ( { 'status' : false } ) ;
46+ } else {
47+ const resp = await analyseUser ( username ) ;
48+ resp [ 'status' ] = true ;
49+ res . send ( resp ) ;
50+ }
51+ } catch {
52+ res . send ( { 'status' : false } ) ;
53+ }
54+ } )
55+
4056 app . get ( '/repo/:user/:repo/' , async function ( req : any , res : any ) {
4157 res . type ( 'svg' ) ;
4258
@@ -57,6 +73,23 @@ export function createServer(): void {
5773 }
5874 } ) ;
5975
76+ app . get ( '/api/repo/:user/:repo/' , async function ( req : any , res : any ) {
77+ const username = req . params [ 'user' ] ,
78+ repo = req . params [ 'repo' ] ;
79+
80+ try {
81+ if ( ! await isExistRepo ( username , repo ) ) {
82+ res . send ( { 'status' : false } ) ;
83+ } else {
84+ const resp = await analyseRepo ( username , repo ) ;
85+ resp [ 'status' ] = true ;
86+ res . send ( resp ) ;
87+ }
88+ } catch {
89+ res . send ( { 'status' : false } ) ;
90+ }
91+ } ) ;
92+
6093 app . listen ( port , ( ) =>
6194 logger . info ( `Starting deployment server at http://127.0.0.1:${ port } /.` ) ) ;
6295}
You can’t perform that action at this time.
0 commit comments