@luics/typeorm-server
TypeScript icon, indicating that this package has built-in type declarations

0.7.33 • Public • Published

Typeorm-Server

Inspired by json-server.

Install

global install

npm i -g ts-node @luics/typeorm-server

local install

npm i -D ts-node @luics/typeorm-server

Cli use

global

typeorm-server --config "typeorm-server.json"

npm script

npx typeorm-server --config "typeorm-server.json"

typeorm-server.json sample:

{
  "typeorm": {
    "host": "localhost",
    "port": 3306,
    "username": "test",
    "password": "test",
    "database": "test",
    "synchronize": false,
    "logging": false,
    "entities": ["path/to/entity/*.entity.{ts,js}"]
  },
  "schema": "path/to/entity/schema.json"
}

full doc see TypeormServerConfig

Programmatic use

const app = express();
app.use(express.text({ type: '*/*' }));
app.use(cors({ origin: true, credentials: true }));
app.get('/', (_req, res) => res.json({}));
await useTypeormServerRoutersAsync(app, config, prefix);

Readme

Keywords

none

Package Sidebar

Install

npm i @luics/typeorm-server

Weekly Downloads

7

Version

0.7.33

License

MIT

Unpacked Size

115 kB

Total Files

54

Last publish

Collaborators

  • luics