To create a project:
npx ebp-cli new <project-name>
Then
cd <project-name>
npm run start
# Port number
PORT=3001
src\
|--core\ # Core files
|--modules\ # Modules files (controllers, services, entities, migrations...)
|--index.js # App entry point
The modules sounds like NestJS modules. To create a module:
Create a new folder inside modules directory:
src\
|--core\ # Core files
|--modules\ # Modules files (controllers, services, entities, migrations...)
|----new_module\ # New folder inside modules directory
|--index.js # App entry point
Create controller and service files inside your new folder:
src\
|--core\ # Core files
|--modules\ # Modules files (controllers, services, entities, migrations...)
|----new_module\ # New folder inside modules directory
|------new_module.controller.ts
|------new_module.service.ts
|--index.js # App entry point
Follow the existing examples for more information
The list of available decorators can be found in the decorators file
Code example from status.controller.ts
import { GET, Response } from "@decorators";
import express from "express";
import StatusService from "./status.service";
export default class UserController {
constructor(
private readonly statusService: StatusService = new StatusService()
) {}
@GET() //GET method, default path = /
public async getStatus(@Response() res: express.Response) {
res.send(await this.statusService.getStatus());
}
}