본문 바로가기

⭐ JAVASCRIPT

javascript - import - export 하는 방법

import 하는 방법
import {Coffee, ICoffee} from "../domain/coffee";

-------------------------------------------------------------------------------------

export 하는 방법
export interface ICoffee {
    id: string;
    name: string;
    bean: string;
    team_name: string; //추가
}

export class Coffee {
    private PK: string;  // partition key
    id: string;
    name: string;
    bean: string;
    team_name: string; //추가
    

    constructor(coffee: ICoffee) {
        this.PK = coffee.id;
        this.id = coffee.id;
        this.name = coffee.name;
        this.bean = coffee.bean;
        this.team_name = coffee.team_name; //추가
    }
}

-------------------------------------------------------------------------------------

export { uuid }

-------------------------------------------------------------------------------------

export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
    return await RouteRule.create(event)
            // .add(new TeamController())
            // .add(new PlayerController())
            .add(new CoffeeController()).route();
};