- https://docs.nestjs.com/first-steps
- https://nodejs.org/es/
- https://docs.nestjs.com/
- nvm install 10.15.1 x64
- nvm use 10.15.1
- $ npm i -g @nestjs/cli
- nvm uninstall 10.15.1
- nvm install 10.15.1 x32
- nvm use 10.15.1
- $ nest new project-name
- node @nestjs/schematics:application --name=nestjs --directory=undefined --no-dry-run --no-skip-git --no-strict --package-manager="npm" --collection="@nestjs/schematics" --language="ts"
- node @nestjs/schematics:application --name=nestjs --directory=undefined --no-dry-run --no-skip-git --no-strict --package-manager="npm" --collection="@nestjs/schematics" --language="ts"
- $ cd project-name
- $ npm run start
- https://code.visualstudio.com/
- Vscode NestJs Snippets
- $ git clone https://github.com/nestjs/typescript-starter.git project
- $ cd project
- $ npm install
- $ npm run start
- Peticiones
Post localhost:3000/mensajes/ { "nick":"Miguel", "mensaje":"Este es un mensaje" }
Get localhost:3000/mensajes?id=1 localhost:3000/mensajes/
Put localhost:3000/mensajes/1 { "nick":"Miguel 2", "mensaje":"Este es un mensaje 2" }
Delete localhost:3000/mensajes/1
- Provider
https://docs.nestjs.com/providers
- repositorio y proveedores
https://docs.nestjs.com/cli/usages nest g service mensajes
- Declaración de entidades
nest g class mensajes/mensaje
- Conexión a base de datos
https://docs.nestjs.com/techniques/database npm install --save @nestjs/typeorm typeorm mysql
- Controllers
https://docs.nestjs.com/controllers nest generate controller cats nest generate controller mensajes nest generate class mensajes/dto/create-mensaje-dto
- Extensiones de visual studio code
Vscode NestJs Snippets
xampp
nest app
CREATE USER 'nest'@'localhost' IDENTIFIED VIA mysql_native_password USING '**';GRANT ALL PRIVILEGES ON . TO 'nest'@'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;GRANT ALL PRIVILEGES ON sendmeanapp_db. TO 'nest'@'localhost';