TypeORM

오픈소스·2022년 12월 3일
0
post-thumbnail

https://typeorm.io/#quick-start

$ npx typeorm init --name MyProject --database postgres --module esm --docker
$ cd MyProject
$ npm i
$ docker-compose up
$ npm start

> MyProject@0.0.1 start
> node --loader ts-node/esm src/index.ts

(node:26561) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error [ERR_LOADER_CHAIN_INCOMPLETE]: "ts-node/esm 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
    at new NodeError (node:internal/errors:393:5)
    at ESMLoader.resolve (node:internal/modules/esm/loader:846:13)
    at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:425:7)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:527:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12) {
  code: 'ERR_LOADER_CHAIN_INCOMPLETE'
}
$ npm install ts-node@latest // or ncu -u; npm i

added 3 packages, removed 1 package, changed 2 packages, and audited 153 packages in 1s

19 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ npm start

> MyProject@0.0.1 start
> node --loader ts-node/esm src/index.ts

(node:26615) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Inserting a new user into the database...
Saved a new user with id: 1
Loading users from the database...
Loaded users:  [ User { id: 1, firstName: 'Timber', lastName: 'Saw', age: 25 } ]
Here you can setup and run express / fastify / any other framework.

0개의 댓글