Example #1
0
import * as webhost from 'webhost';

var server = new webhost.Server({
    rootApp: __dirname,
    wwwroot: `${__dirname}\\wwwroot`
});

server.configureServices((services): void => {
});

server.configure((app) => {

    app.use(webhost.DefaultFiles);

    app.use(webhost.StaticFiles);

    app.useErrorNotFound();

});

server.listen(1337);
Example #2
0
import * as webhost from 'webhost';
import * as api from 'webhost-api';

var server = new webhost.Server({
    rootApp: __dirname,
    wwwroot: __dirname + '/wwwroot'
});

server.configureServices((services): void => {

    api.addServices(services, {
        routes: [{
            name: 'default',
            pattern: 'api/{controller}/{index}'
        }]
    });

});

server.configure((app) => {
    
    //app.debug();

    app.use(api.Api);

    app.useErrorNotFound();

});

server.listen(1338);
Example #3
0
import { Server, DefaultFiles, StaticFiles } from 'webhost';
import { Es6Adapter } from './es6-adapter';

var server = new Server({
    rootApp: __dirname,
    wwwroot: __dirname + '/../wwwroot'
});

server.configureServices((services): void => {
});

server.configure((app) => {

    app.use(Es6Adapter);

    app.use(StaticFiles);

    app.useErrorNotFound();

});

server.listen(1338);
Example #4
0
import { Server, DefaultFiles, StaticFiles } from 'webhost';
import { addServices, ClientFile } from 'webhost-websocket';
import ChatHub from './ChatHub';

var server = new Server({
    rootApp: __dirname,
    wwwroot: __dirname + '/wwwroot'
});

server.configureServices((services): void => {

    addServices(services, [
        { path: 'Chat', item: ChatHub }
    ]);

});

server.configure((app) => {
    
    app.use(ClientFile);

    app.use(DefaultFiles);

    app.use(StaticFiles);

    app.useErrorNotFound();

});

server.listen(1338);