DEV Community

Cover image for ExpressWebJs 3.2 Released
Chukwuemeka Igbokwe
Chukwuemeka Igbokwe

Posted on

3 1

ExpressWebJs 3.2 Released

The ExpressWebJs team have released 3.2 with auto endpoint documentation, and improvement in service injection.

Auto Endpoint Documentation:

Reference documentation for API endpoints consists of five general sections: resource descriptions, endpoints and methods, parameters, sample requests, and sample responses and schemas. All these are auto documented for you while you code, to allow you focus on building your amazing application.

To get started, install ExpressWebJs by running the command below

 npx expresswebcli new MyApplication --ts
Enter fullscreen mode Exit fullscreen mode

and run 'npm install' to install the node packages 📦. Then create few endpoints and visit your base url in a browser followed by /documentationView for HTML view or /documentationJson for JSON.

Example: http://127.0.0.1:5000/documentationView or http://127.0.0.1:5000/documentationJson.

Service Injection

You can now inject services irrespective of the order in the application context.

In our Application Service Provider register method, we've registered some services.


  public register() {
    this.app.singleton("UserService", UserService, "class");
    this.app.singleton("CompanyService", CompanyService, "class");
    this.app.singleton("FolderService", FolderService, "class");
  }

Enter fullscreen mode Exit fullscreen mode

Now we can inject UserService into FolderService like so:


import FolderRepository from "App/Repository/FolderRepository";
import BaseService from "../BaseService";
import IFolderService from "./IFolderService";
import IUserService from "./IUserService";

class FolderService extends BaseService implements
  protected userService:IUserService

  constructor(UserService:IUserService){
    this.userService = UserService
  }

 IFolderService {
  async getSubFolders(user_id: string): Promise<object> {
    return await new Promise(async (resolve, reject) => {
      try {
        let data = await new userService().findById(user_id);
        ...
      } catch (error: any) {
        ...
      }
    });
  }
}

Enter fullscreen mode Exit fullscreen mode

You can join ExpressWebJs community on Discord and don't forget to give us a star on github
ExpressWebJs Javascript and ExpressWebJs Typescript

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay