Socket
Socket
Sign inDemoInstall

@wtprograms/mvc

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wtprograms/mvc

Brings MVC architecture to express.


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

mvc

mvc provides an very simplified MVC framework similar to that of .NET Core MVC.

Index

Installation

Installation

npm install --save @wtprograms/mvc

Usage

import {
  WebHostBuilder,
  DEFAULT_COLOR_MAPS,
  ConsoleLoggerProvider,
  FileLoggerProvider,
  IStartup,
  ControllerRoute,
  HttpGet,
  HttpPost,
  Model,
  HttpDelete
} from '@wtprograms/mvc';

@ControllerRoute('/values')
class ValuesController {
  @HttpGet()
  get() {
    return ['value1', 'value2'];
  }

  @HttpGet('/:id')
  getSingle(id: number) {
    return 'value';
  }

  @HttpPost()
  post(@Model() value: string) {}

  @HttpDelete('/:id')
  delete(id: number) {}
}

class Startup implements IStartup {
  configure(context: ApplicationContext) {
    context.loggerFactory.loggingLevel = LogLevel.debug;
    context.loggerFactory.providers.push(
      new ConsoleLoggerProvider(DEFAULT_COLOR_MAPS)
      new FileLoggerProvider('./app.log'));

    context.controllers.push(ValuesController);
  }
}

new WebHostBuilder()
  .useStartup(Startup)
  .build()
  .run(5000);

Keywords

FAQs

Package last updated on 01 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc