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! It'll help increase our visibility and support our efforts. ๐ Thanks in advance!
๐ Non-Opinionated Template
- Simplified Middleware Passing
Pass middleware with ease in the
AppFactory.create()
method:
async function bootstrap() {
const app = await AppFactory.create(container, [cors(), helmet()]);
await app.listen(3000, ServerEnvironment.Development);
}
- Setting Node Environment Automatically set your Node environment just by selecting an enum option:
- Development
- Production
await app.listen(3000, ServerEnvironment.Development);
Direct Access to Expressjs Object
Configure and set up your application directly with the ExpressApp object.Global Route Prefix
Easily set the global prefix during your application's bootstrap phase:
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:
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:
- Global Route Prefix: Set your global prefix seamlessly.
- Utility isDevelopment Method: A convenient way to perform operations based on your environment:
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 ...
๐ฆ Performance Enhancements
We're also excited to announce a 50% reduction in our library bundle size, ensuring a smoother and faster experience for all!
Top comments (2)
Congrats!
Thank you!