Aca.ts is a full stack development tool without backend development, which can automatically synchronize database schema and generate database query APIs according to a typescript ORM document; Automatically generate the client access server APIs accordin
npm install aca.tsEnglish | 中文文档
typescript
namespace db {
export class user {
id: id
@$_.unique name: string
age?: int
married = false
profile?: profile
posts: post[]
}
export class profile {
id: id
password: string
@$_.foreign('userId') user: user
}
@$.view('select "user"."id" as "userid", "user"."name", "user"."married", "user"."age", "profile"."password" from "user" left join "profile" as "profile" on "user"."id" = "profile"."userId"')
class userProfile {
userid: id
@$_.unique name: string
married = false
age?: int
password?: string
}
export class post {
id: id
content: string
score: float
@$_.foreign('userId') user: user
categories: category[]
}
export class category {
id: id
name: string
@$_.foreign('categoryId') parent?: category
children: category[]
posts: post[]
}
}
`
Installation
`bash
npm install -g aca.ts
`
Usage
1. Create an aca project:
`bash
$ aca create
$ cd
`
2. Open .aca directory, copy your custom ORM file into the directory, and add this file name to config.json/orm field.
3. Use the following method to create aca.ts apps:
Create a backend app (a simple koa framework):
`bash
$ aca server
`
Create a frontend app (a react app with create-react-app):
`bash
$ aca client
`
Add self built app to the project:
`bash
$ aca add --server --client --apiDir
path default: src/aca.server src/aca.client
`
4. Generate api
`bash
$ aca up
``