@luics/typeorm-server
v0.7.33
Published
Inspired by json-server
Downloads
35
Readme
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);