ExpressoTS 2.6.0 is Out!
Tags: api, typescript, expressots, framework
Published: 2023-10-10 08:16:09

# New Features in ExpressoTS: Boosting Backend Development!
We're thrilled to introduce the latest features in ExpressoTS designed to accelerate your backend development. Dive in to explore what we have in store for you:

Consider giving our project a star on [GitHub ExpressoTS](https://github.com/expressots/expressots)! It'll help increase our visibility and support our efforts. 🌟 Thanks in advance!

## 🚀 Non-Opinionated Template

1. Simplified Middleware Passing
Pass middleware with ease in the `AppFactory.create()` method:

```typescript
async function bootstrap() {
  const app = await AppFactory.create(container, [cors(), helmet()]);
  await app.listen(3000, ServerEnvironment.Development);
}
```
2. Setting Node Environment
Automatically set your Node environment just by selecting an enum option:
- Development
- Production

```typescript
await app.listen(3000, ServerEnvironment.Development);
```

3. Direct Access to Expressjs Object
Configure and set up your application directly with the ExpressApp object.

4. Global Route Prefix
Easily set the global prefix during your application's bootstrap phase:

```typescript
app.setGlobalRoutePrefix("/api");
```

## 🏆 Opinionated Template

The App class provider is the cornerstone of the opinionated template. From initialization to server bootstrap configuration, it covers it all:

```typescript
class App extends AppExpress {
  private middleware: IMiddleware;
  private provider: IProvider;

  constructor() {
    super();
    this.middleware = container.get<IMiddleware>(Middleware);
    this.provider = container.get<IProvider>(Provider);
  }

  protected configureServices(): void {
    this.middleware.addBodyParser();
    this.middleware.setErrorHandler();
  }

  protected postServerInitialization(): void {
    if (this.isDevelopment()) {
      this.provider.envValidator.checkAll();
    }
  }

  protected serverShutdown(): void {}
}
```
## Key Highlights:

- Out-of-the-box Middlewares:
Here is a list of currently available middlewares out-of-the-box:

![Middlewares Available](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ll2b50bsxojr25rykl0.png)

- Global Route Prefix: Set your global prefix seamlessly.
- Utility isDevelopment Method: A convenient way to perform operations based on your environment:

```typescript
class App extends AppExpress {
  private middleware: IMiddleware;
  private provider: IProvider;

  constructor() {
    super();
    this.middleware = container.get<IMiddleware>(Middleware);
    this.provider = container.get<IProvider>(Provider);
  }

  protected configureServices(): void {
    this.setGlobalRoutePrefix("/api"); // Global prefix
    this.middleware.addBodyParser();
    this.middleware.setErrorHandler();
  }

  protected postServerInitialization(): void {
    if (this.isDevelopment()) { // isDevelopment method
      this.provider.envValidator.checkAll();
    }
  }

  protected serverShutdown(): void {}
}
```

## 📖 Code by Example
Want hands-on experience with ExpressoTS features? We've dedicated a whole section to coding examples in our documentation. Ease your search and coding journey with us. Dive in [here ...](https://doc.expresso-ts.com/docs/category/code-by-example)

## 📦 Performance Enhancements
We're also excited to announce a 50% reduction in our library bundle size, ensuring a smoother and faster experience for all!