1
- // coding=utf-8
2
-
3
- // Copyright [2024] [SkywardAI]
4
- // Licensed under the Apache License, Version 2.0 (the "License");
5
- // you may not use this file except in compliance with the License.
6
- // You may obtain a copy of the License at
7
-
8
- // http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- // Unless required by applicable law or agreed to in writing, software
11
- // distributed under the License is distributed on an "AS IS" BASIS,
12
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- // See the License for the specific language governing permissions and
14
- // limitations under the License.
15
-
16
- import { Router } from "express" ;
17
-
18
- import inferenceRoute from "./inference.js" ;
19
- import tokenRoute from "./token.js" ;
20
- import tracingRoute from "./tracing.js" ;
21
- import embeddingRoute from "./embedding.js" ;
22
- import encoderRoute from "./encoder.js" ;
23
- import decoderRoute from "./decoder.js" ;
24
-
25
- function indexRoute ( ) {
26
- const router = Router ( ) ;
27
-
28
- router . get ( '/healthy' , ( _ , res ) => {
29
- res . status ( 200 ) . send ( 'ok' )
30
- } )
31
-
32
- return router ;
33
- }
34
-
35
- function generateAPIRouters ( ) {
36
- const api_router = Router ( ) ;
37
-
38
- api_router . use ( '/chat' , inferenceRoute ( ) ) ;
39
- api_router . use ( '/token' , tokenRoute ( ) ) ;
40
- api_router . use ( '/tracing' , tracingRoute ( ) ) ;
41
- api_router . use ( '/embeddings' , embeddingRoute ( ) ) ;
42
- api_router . use ( '/encoder' , encoderRoute ( ) ) ;
43
- api_router . use ( '/decoder' , decoderRoute ( ) ) ;
44
-
45
- return api_router ;
46
- }
47
-
48
- export default function buildRoutes ( app ) {
49
- app . use ( '/' , indexRoute ( ) ) ;
50
- app . use ( '/v1' , generateAPIRouters ( ) ) ;
1
+ // coding=utf-8
2
+
3
+ // Copyright [2024] [SkywardAI]
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+
16
+ import { Router } from "express" ;
17
+
18
+ import inferenceRoute from "./inference.js" ;
19
+ import tokenRoute from "./token.js" ;
20
+ import tracingRoute from "./tracing.js" ;
21
+ import embeddingRoute from "./embedding.js" ;
22
+ import encoderRoute from "./encoder.js" ;
23
+ import decoderRoute from "./decoder.js" ;
24
+ import versionRoute from "./version.js" ;
25
+
26
+ function indexRoute ( ) {
27
+ const router = Router ( ) ;
28
+
29
+ router . get ( '/healthy' , ( _ , res ) => {
30
+ res . status ( 200 ) . send ( 'ok' )
31
+ } )
32
+
33
+ return router ;
34
+ }
35
+
36
+ function generateAPIRouters ( ) {
37
+ const api_router = Router ( ) ;
38
+
39
+ api_router . use ( '/chat' , inferenceRoute ( ) ) ;
40
+ api_router . use ( '/token' , tokenRoute ( ) ) ;
41
+ api_router . use ( '/tracing' , tracingRoute ( ) ) ;
42
+ api_router . use ( '/embedding' , embeddingRoute ( ) ) ;
43
+ api_router . use ( '/encoder' , encoderRoute ( ) ) ;
44
+ api_router . use ( '/decoder' , decoderRoute ( ) ) ;
45
+ api_router . use ( '/version' , versionRoute ( ) ) ;
46
+
47
+ return api_router ;
48
+ }
49
+
50
+ export default function buildRoutes ( app ) {
51
+ app . use ( '/' , indexRoute ( ) ) ;
52
+ app . use ( '/v1' , generateAPIRouters ( ) ) ;
51
53
}
0 commit comments