1.2.0 • Published 10 months ago

@azera/stack v1.2.0

Weekly downloads
47
License
MIT
Repository
-
Last release
10 months ago

Azera Stack - A Full-Stack NodeJS Framework

A full-stack NodeJS Framework influenced by Symfony

Features

  • TypeScript
  • Bundle
  • Dependency Injection
  • Configuration
  • Decorators (Template, Routing, ...)
  • Cli Command
  • Maker (Controller, Entity, ...)
  • Simplicity
  • EventManager
  • Message Manager (Message-Queue, Email, SMS, ...)
  • SQL and NoSQL (TypeORM, Mongoose, MongoDb)
  • Authentication and Authorization
  • Http Client and HTML parser
  • Profiler
  • WorkFlow Manager
  • Proxy Manager
  • Meta-data Manager

Install

Execute this commands in your project directory :

# Initialize your project directory
yarn init

# Install Azera Stack module and initialize project structure
yarn add @azera/stack

# Build to generate dist from typescript files
yarn build

# Done !

Aftre than you will see this folder stucture in your directory :

- src
    - index.ts
- tests
- app.config.json
- tsconfig.json

Also cli, web, watch and build scripts will be added to your package.json , then add your first controller by next step.

Make Controller

Make a controller by following command :

yarn cli make:controller [Name] --path [Route path]

for example you may want to add Book controller :

yarn cli make:controller Book

it will generate BookController.ts with route path /book and add BookController to your app.config.json > services

Make Entity

# Make a TypeORM (SQL) entity :
yarn cli make:entity [Name]

# Make a TypeORM (Mongo) document :
yarn cli make:entity [Name] --mongo

Configuration

Azera stack is based on configuration file (default: "app.config.json"), many configuration and customization will be configured in that file. for example you may want to config your database connection :

// app.config.json
{
	"typeOrm": {
		"connections": {
            // You can have multiple different connections
			"app": {
				"database": "test",     // Database name
				"host": "127.0.0.1",    // Database Host
				"username": "test",     // Database username
				"password": "test",     // Database password
				"type": "mssql",        // Connection driver
				"entities": [
					"/entity/Book" // instead of "/src/entity/Book.ts"
				]
			}
        },
        // Default connection name
        "defaultConnection": "app"
	}
}

and you can use your entities in you application :

// src/controller/BookController.ts
import { Controller, Get, Inject, Param, Request, Response } from '@azera/stack';
import { EntityManager } from 'typeorm';
import { Book } from '../entity/Book';

@Controller('/book')
export class BookController {

    @Get('/') @Inject() async books(em: EntityManager) {
        return em.find(Book);
    }

    @Get('/book/:id') @Inject() async book(em: EntityManager, @Param() id: string) {
        return em.findOne(User, id);
    }

}

That's simple

Build your project

yarn build
# Or
yarn watch

Authors

  • Masoud Zohrabi (mdzzohrabi@gmail.com)
1.2.0

10 months ago

1.1.34

2 years ago

1.1.29

2 years ago

1.1.28

2 years ago

1.1.30

2 years ago

1.1.33

2 years ago

1.1.32

2 years ago

1.1.31

2 years ago

1.1.27

2 years ago

1.1.26

2 years ago

1.1.25

2 years ago

1.1.24

3 years ago

1.1.23

3 years ago

1.1.22

3 years ago

1.1.21

3 years ago

1.1.20

3 years ago

1.1.18-stack

3 years ago

1.1.17-stack

3 years ago

1.1.16-stack

3 years ago

1.1.14-stack

3 years ago

1.1.15-stack

3 years ago

1.1.13-stack

3 years ago

1.1.12-stack

3 years ago

1.1.11-stack

3 years ago

1.1.9-stack

3 years ago

1.1.10-stack

3 years ago

1.1.8-stack

3 years ago

1.1.7-stack

3 years ago

1.1.6-stack

3 years ago

1.1.5-stack

3 years ago

1.1.4-stack

3 years ago

1.1.3-stack

3 years ago

1.1.2-stack

3 years ago

1.1.1-stack

3 years ago

1.1.0-stack

3 years ago

1.1.0

3 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago