DEV Community

Cover image for ExpressWebJs 3.2 Released
Alex Igbokwe
Alex 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)

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!