@umberware/the-way
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.3.7.5 • Public • Published

The Way Logo

A framework to enhance the development with Node.js and Typescript, promoting agility, simplicity, scalability and intelligibility. With TheWay, the sky is not the limit!

Site Documentation Changelog Examples License EsLint Build Status Coverage Sponsor Follow Discord

Note: The release 1.0.0 will occur soon!

Summary

Features

Using TheWay, you can easily and simply define REST operations, inject instances of a class, automatically configure and destroy instances, override classes to define a custom behavior, enable/disable features, and much more. The proposal of TheWay is to enhance the life cycle of the development in Node.js with a lot of features. The main features are:

  • Class Injection & Singleton: When the @Inject decorator is used, a dependency will be registered, and the Core will instantiate this dependency (as singleton) and inject at the injection point
  • REST Operations & Concepts: With the Rest Decorators, you can create REST operations with intelligibility, security and conciseness
  • HTTP and HTTPS server: We use the express to build a http and / or https server, and you can customize some properties for this server
  • Configurable & Destroyable: When you want to configure something before the "running state", you can extend the Configurable class and implement the method configure or if you want to execute something before the destruction, you can extend the Destroyable class and implement the method destroy
  • Automatic Components Scan: By default, classes decorated with an Application Components Decorator and placed in the scan path, will be automatically registered in the Core. You can disable this feature and manually inject into your main class, the components. For more information, please visit the documentation
  • Overridden: In some cases, we want to create a custom class and replace the old behavior, thinking about it, the @Configuration and @Service can be used to do this. When you pass as argument a class in these decorators, the core will inject the override class instead of the original class at the injection points
  • YAML Application Properties: We use YAML format to provide a lot of properties that can enable some feature or change their behavior

Installing

TheWay is built for projects designed with NodeJs and Typescript.

You can check how to create a NodeJs + Typescript project here

Installing the TheWay:

For Yarn

yarn add @umberware/the-way

For Npm

npm install @umberware/the-way

Remember to install @types/node as dev dependencies when you are using the typescript with Node

Getting Started

In this section, we will create a simple application that uses TheWay.

It is imperative that you have: NodeJs installed and a NodeJs project configured to use typescript. You can check how to configure Node.js to work with Typescript in this guide: NodeJs With Typescript

Installing: @umberware/TheWay

npm install @umberware/the-way

Creating: A Main class(src/main/main.ts)

import { Application, TheWayApplication, Inject, CoreLogger } from '@umberware/the-way';

@Application()
export class Main extends TheWayApplication {
    @Inject logger: CoreLogger;

    public start(): void {
        this.logger.info('Hello World');
    }
}

Running: The Typescript source code (via ts-node)

ts-node src/main/main.ts

Build & Run: The final Javascript code

Build

tsc

Running the built code

node disc/src/main/main.js

You can check how to build a REST application in this guide: TheWay: HeroesRest

For more examples or guides, you can access the The Way Examples Repository or/and Guides

Remember to install @types/node as dev dependencies when you are using the typescript with Node

Application Properties

This framework uses application properties in Yaml Format and has a lot of properties that can be changed for your use. If no application properties is provided, the framework will use the default properties. For more detail, please visit the Application Properties Documentation

Documentation

To access the full documentation you can access this

Package Sidebar

Install

npm i @umberware/the-way

Weekly Downloads

3

Version

1.0.0-beta.3.7.5

License

MIT

Unpacked Size

268 kB

Total Files

123

Last publish

Collaborators

  • hanor