Unverified Commit d15ddb49 authored by chicm-ms's avatar chicm-ms Committed by GitHub
Browse files

Download log (#478)

* Support download log files

* updates
parent d1008bb3
......@@ -19,11 +19,12 @@
'use strict';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as express from 'express';
import * as path from 'path';
import * as component from '../common/component';
import { RestServer } from '../common/restServer'
import { getLogDir } from '../common/utils';
import { createRestHandler } from './restHandler';
/**
......@@ -35,6 +36,7 @@ import { createRestHandler } from './restHandler';
@component.Singleton
export class NNIRestServer extends RestServer {
private readonly API_ROOT_URL: string = '/api/v1/nni';
private readonly LOGS_ROOT_URL: string = '/logs';
/**
* constructor to provide NNIRestServer's own rest property, e.g. port
......@@ -50,6 +52,7 @@ export class NNIRestServer extends RestServer {
this.app.use(express.static('static'));
this.app.use(bodyParser.json());
this.app.use(this.API_ROOT_URL, createRestHandler(this));
this.app.use(this.LOGS_ROOT_URL, express.static(getLogDir()));
this.app.get('*', (req: express.Request, res: express.Response) => {
res.sendFile(path.resolve('static/index.html'));
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment