update initial test

This commit is contained in:
2018-03-08 23:42:46 +01:00
parent b9990c3953
commit f812249a0d
19 changed files with 486 additions and 50 deletions

View File

@ -1 +1 @@
export * from './smartuniverse.classes.smartuniverse';
export * from './smartuniverse.classes.smartuniverse';

View File

@ -1,5 +1,42 @@
import * as plugins from './smartuniverse.plugins';
export Smartuniverse {
}
import { Handler, Route, Server } from 'smartexpress';
import * as paths from './smartuniverse.paths';
export interface ISmartUniverseConstructorOptions {
port: number | string;
}
export class SmartUniverse {
private options: ISmartUniverseConstructorOptions;
private universeVersionStore: string;
private get universeVersion() {
if (this.universeVersionStore) {
return this.universeVersionStore;
} else {
const packageJson = plugins.smartfile.fs.toObjectSync(paths.packageJson);
this.universeVersionStore = packageJson.version;
return this.universeVersionStore;
}
}
private smartexpressServer: plugins.smartexpress.Server;
constructor(optionsArg: ISmartUniverseConstructorOptions) {
this.options = optionsArg;
}
public async init() {
this.smartexpressServer = new plugins.smartexpress.Server({
cors: true,
defaultAnswer: `smartuniverse server ${this.universeVersion}`,
forceSsl: false,
port: this.options.port
});
const addRoute = new Route(this.smartexpressServer, 'addMessage');
const addHandler = new Handler('PUT', requestBody => {
return 'hi';
});
// await this.smartexpressServer.addRoute()
}
}

View File

@ -1,9 +1,13 @@
import * as plugins from './smartuniverse.plugins';
import { SmartUniverse } from './index';
process.env.CLI = 'true';
const universeCli = new plugins.smartcli.Smartcli();
universeCli.standardTask().then(argvArg => {
});
const standardUniverse = new SmartUniverse({
port: 8765
});
});

View File

@ -0,0 +1,3 @@
import * as plugins from './smartuniverse.plugins';
export const packageJson = plugins.path.join(__dirname, '../package.json');

View File

@ -1,4 +1,6 @@
import * as path from 'path';
import * as smartcli from 'smartcli';
import * as smartexpress from 'smartexpress';
import * as smartfile from 'smartfile';
export { smartcli, smartexpress };
export { path, smartcli, smartexpress, smartfile };