@move.box/ts-gc-express
v1.5.0
Published
- npx @move.box/ts-gc-express@latest create
Maintainers
Readme
Create
- npx @move.box/ts-gc-express@latest create
Start
Dev
- Run dev
npm install
npm run devUse APIService check
import { RequestMethod } from './src/DataService/APIRequest'
import { APIService, APIServiceError } from './src/DataService/APIService'
import { TodoItem } from './src/Main/BizModels/TodoModel'
import { LogPrefix } from './src/Utils/LogPrefix'
async function test() {
try {
const list = await APIService.fetch<TodoItem[]>({
url: 'http://localhost:8899/todo/all',
method: RequestMethod.GET
})
console.log(list)
const filterList = await APIService.fetch<TodoItem[]>({
url: 'http://localhost:8899/todo/filter',
method: RequestMethod.POST,
params: {
name: 'ing'
}
})
console.log(filterList)
const filterList2 = await APIService.fetch<TodoItem[]>({
url: 'http://localhost:8899/todo/filter',
method: RequestMethod.POST,
params: {
name: 'ing',
completed: true
}
})
console.log(filterList2)
} catch (error) {
if (error instanceof APIServiceError) {
console.log(`${LogPrefix.error}Response error`, error.code, error.message)
} else {
console.error(error)
}
}
}
test()Pro
- npm run start
Deploy with docker
docker-compose build
docker-compose up -d