File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish to npm
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ publish :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - uses : actions/checkout@v3
14+
15+ - name : Use Node.js
16+ uses : actions/setup-node@v3
17+ with :
18+ node-version : 18
19+ registry-url : " https://registry.npmjs.org/"
20+
21+ - name : Install dependencies
22+ run : npm install
23+
24+ - name : Auto bump version
25+ run : npm version patch --no-git-tag-version
26+
27+ - name : Publish to npm
28+ run : npm publish
29+ env :
30+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 1+ ## this app for test
Original file line number Diff line number Diff line change 1+ import { hamo } from "./modules/hamo/hamo.controller" ;
12import { kkkkkkk } from "./modules/kkkkkkk/kkkkkkk.controller" ;
23import { ui } from "./modules/ui/ui.controller" ;
34import { kdm } from "./modules/kdm/kdm.controller" ;
45import Elysia from "elysia" ;
56
67console . log ( "kfmkfm" ) ;
7- const app = new Elysia ( ) . use ( kdm )
8- . use ( ui )
9- . use ( kkkkkkk )
10- . listen ( 95995 ) ;
8+ const app = new Elysia ( ) . use ( kdm ) . use ( ui ) . use ( kkkkkkk ) . use ( hamo ) . listen ( 95995 ) ;
119
1210console . log (
1311 `🦊 Elysia is running at ${ app . server ?. hostname } :${ app . server ?. port } `
Original file line number Diff line number Diff line change 1+ import { Elysia } from "elysia" ;
2+ import { HamoService } from "./hamo.service" ;
3+ import { HamoModel } from "./hamo.model" ;
4+
5+ export const hamo = new Elysia ( { prefix : "/hamos" } )
6+ . get ( "/" , async ( ) => {
7+ return HamoService . findAll ( ) ;
8+ } )
9+ . get ( "/:id" , async ( { params } ) => {
10+ return HamoService . findOne ( params . id ) ;
11+ } , {
12+ params : HamoModel . HamoParams
13+ } )
14+ . post ( "/" , async ( { body } ) => { } , {
15+ body : HamoModel . HamoBody ,
16+ } )
17+
Original file line number Diff line number Diff line change 1+ import { t } from 'elysia'
2+
3+ export namespace HamoModel {
4+ export const HamoBody = t . Object ( {
5+ name : t . String ( ) ,
6+ } ) ;
7+
8+ // Define it as TypeScript type
9+ export type HamoBodyType = typeof HamoBody . static ;
10+
11+ export const HamoParams = t . Object ( {
12+ id : t . String ( ) ,
13+ } ) ;
14+ }
Original file line number Diff line number Diff line change 1+ export abstract class HamoService {
2+ static async findAll ( ) {
3+ // TODO: Add logic here
4+ return [ ] ;
5+ }
6+
7+ static async findOne ( id : string ) {
8+ // TODO: Add logic here
9+ return { id } ;
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments