Nemo's Parental Misguidance
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@node-ts-autumn/server

0.3.4 • Public • Published

@node-ts-autumn/server


server-module

server module for @node-ts-autumn/core

server-module

...for typescript node mvc framework @node-ts-autumn/core

development state

alpha version

Features

  • link more than one @node-ts-autumn/core application to one server with different contexts

Install

npm

`npm install @node-ts-autumn/server

tsconfig

    {
        "compilerOptions": {
            "typeRoots": ["node_modules/@types", "node_modules/@node-ts-autumn"],
            "types": ["node","server"],
        },
    }

Example Server

Server

Configure the main server by setting up an Server class that extends the AbstractServer class from @node-ts-autumn/server.

This is an example Server class for the server.

global['basepath'] = __dirname;
import { AbstractServer, ServerConfig  } from '@node-ts-autumn/server';
import { Application } from '@node-ts-autumn/server';
 
import { MyServerConfig } from './lib/config/server/server_config';
import { MyApplication } from './lib/application';
import { FileApplication } from './lib/file_application';
 
export class MyServer extends AbstractServer {
 
    constructor () {
        super();
    }
 
    public getServerConfig (): ServerConfig {
        let serverConfig: ServerConfig = new MyServerConfig();
        return serverConfig;
    }
 
    public getApplications (): Array<Application> {
        let applications: Array<Application> = new Array<Application>();
        applications.push(new FileApplication());
        applications.push(new MyApplication());
        return applications;
    }
}
 
!new MyServer();
 

ServerConfig

import { AbstractServerConfig, ServerConfig } from '@node-ts-autumn/server';
 
 
export class MyServerConfig extends AbstractServerConfig implements ServerConfig {
 
    constructor () {
        super();
        this.setPort(3000);
        this.setStartUpMessage('MyServer');
    }
}
 

Install

npm i @node-ts-autumn/server

DownloadsWeekly Downloads

1

Version

0.3.4

License

MIT

Last publish

Collaborators

  • avatar