kentloog / nestjs-sequelize-typescript Goto Github PK
View Code? Open in Web Editor NEWNest + sequelize-typescript + JWT + Jest + Swagger
Nest + sequelize-typescript + JWT + Jest + Swagger
Is there a way to define the validators for the DB model and the DTO classes at the same time?
Currently the validating decorators have to be copied to both, making updating validation rules more difficult.
Cheers
D:\testing\nodejs\nestjs-sequelize-typescript\node_modules.bin\sequelize:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at wrapSafe (node:internal/modules/cjs/loader:1383:18)
at Module._compile (node:internal/modules/cjs/loader:1412:20)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
at Module.load (node:internal/modules/cjs/loader:1282:32)
at Function.Module._load (node:internal/modules/cjs/loader:1098:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:5)
at main (D:\testing\nodejs\nestjs-sequelize-typescript\node_modules\ts-node\src\bin.ts:227:14)
at Object. (D:\testing\nodejs\nestjs-sequelize-typescript\node_modules\ts-node\src\bin.ts:513:3)
Hi,
I created a simple Dockerfile:
FROM node:11
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "run", "start"]
But I'm receiving this error:
Error: /usr/src/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:857:18)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/usr/src/app/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/usr/src/app/src/users/users.service.ts:3:1)
at Module._compile (internal/modules/cjs/loader.js:816:30)
at Module.m._compile (/usr/src/app/node_modules/ts-node/src/index.ts:439:23)
at Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Object.require.extensions.(anonymous function) [as .ts] (/usr/src/app/node_modules/ts-node/src/index.ts:442:12)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (internal/modules/cjs/helpers.js:14:16)
at Object.<anonymous> (/usr/src/app/src/users/users.controller.ts:18:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ts-node -r tsconfig-paths/register src/main.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[email protected] start:dev /home/ideal21/Documents/NestJs/nestjs-sequelize-typescript
nodemon
[nodemon] 1.18.11
[nodemon] to restart at any time, enter rs
[nodemon] watching: /home/ideal21/Documents/NestJs/nestjs-sequelize-typescript/src/**/*
[nodemon] starting ts-node -r tsconfig-paths/register src/main.ts
[Nest] 12469 - 05/15/2019, 9:43 AM [NestFactory] Starting Nest application...
[Nest] 12469 - 05/15/2019, 9:43 AM [InstanceLoader] AppModule dependencies initialized +26ms
[Nest] 12469 - 05/15/2019, 9:43 AM [InstanceLoader] SharedModule dependencies initialized +0ms
[Nest] 12469 - 05/15/2019, 9:43 AM [InstanceLoader] PostsModule dependencies initialized +339ms
[Nest] 12469 - 05/15/2019, 9:43 AM [InstanceLoader] UsersModule dependencies initialized +2ms
(node:12469) [SEQUELIZE0002] DeprecationWarning: The logging-option should be either a function or false. Default: console.log
Executing (default): CREATE TABLE IF NOT EXISTS user
(id
CHAR(36) BINARY , email
VARCHAR(255) UNIQUE, password
VARCHAR(255), first_name
VARCHAR(255), last_name
VARCHAR(255), gender
ENUM('female', 'male'), birthday
DATE, created_at
DATETIME, updated_at
DATETIME, deleted_at
DATETIME, PRIMARY KEY (id
)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM user
FROM nest
Executing (default): CREATE TABLE IF NOT EXISTS post
(id
BIGINT auto_increment , user_id
CHAR(36) BINARY, title
VARCHAR(255), content
VARCHAR(255), created_at
DATETIME, updated_at
DATETIME, deleted_at
DATETIME, PRIMARY KEY (id
), FOREIGN KEY (user_id
) REFERENCES user
(id
) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM post
FROM nest
[Nest] 12469 - 05/15/2019, 9:43 AM [InstanceLoader] DatabaseModule dependencies initialized +175ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RoutesResolver] UsersController {/users}: +363ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/register, POST} route +8ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/login, POST} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/, GET} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/me, GET} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/me, PUT} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/me, DELETE} route +1ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RoutesResolver] PostsController {/posts}: +1ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/, GET} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/:id, GET} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/, POST} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/:id, PUT} route +1ms
[Nest] 12469 - 05/15/2019, 9:43 AM [RouterExplorer] Mapped {/:id, DELETE} route +2ms
[Nest] 12469 - 05/15/2019, 9:43 AM [NestApplication] Nest application successfully started +5ms
^C
ideal21@ideal21:~/Documents/NestJs/nestjs-sequelize-typescript$ npm run start:prod
[email protected] prestart:prod /home/ideal21/Documents/NestJs/nestjs-sequelize-typescript
rimraf dist && npm run build
[email protected] build /home/ideal21/Documents/NestJs/nestjs-sequelize-typescript
tsc -p tsconfig.build.json
[email protected] start:prod /home/ideal21/Documents/NestJs/nestjs-sequelize-typescript
node dist/main.js
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module '/home/ideal21/Documents/NestJs/nestjs-sequelize-typescript/dist/main.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:prod: node dist/main.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ideal21/.npm/_logs/2019-05-15T04_13_37_533Z-debug.log
$ npm install
$ npm run start || npm run start:dev
> [email protected] start:dev C:\Users\.....
> nodemon
[nodemon] 2.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): src\**\*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node -r tsconfig-paths/register src/main.ts`
[Nest] 10564 - 2021. 11. 05. 오후 5:52:26 [NestFactory] Starting Nest application...
[Nest] 10564 - 2021. 11. 05. 오후 5:52:26 [InstanceLoader] AppModule dependencies initialized +11ms
[Nest] 10564 - 2021. 11. 05. 오후 5:52:26 [InstanceLoader] SharedModule dependencies initialized +0ms
[Nest] 10564 - 2021. 11. 05. 오후 5:52:26 [InstanceLoader] PostsModule dependencies initialized +92ms
[Nest] 10564 - 2021. 11. 05. 오후 5:52:26 [InstanceLoader] UsersModule dependencies initialized +0ms
What port is the application running on?
ex) localhost:3000
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.