DEV Community

Cover image for ExpressWebJs 3.2 Released
Chukwuemeka Igbokwe
Chukwuemeka Igbokwe

Posted on

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: or

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() {"UserService", UserService, "class");"CompanyService", CompanyService, "class");"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

    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

Top comments (0)