Nestjs Snippets for VS Code
Simple snippets pack to increase your productivity when developing with nestjs
Created by Manu Codes Make your life easier, use code actions to do repetitive tasks for you! They can help a lot, just follow the light bulb 💡! PrerequisiteSponsorI open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can use this service for free. However, if you are using this project and are happy with it or just want to encourage me to continue creating stuff, there are a few ways you can do it:-
Installation
Can also be installed using the command line
JavaScript Snippet Pack for Visual Studio CodeDownload this extension from the Visual Studio Code Marketplace Supported languages (file extensions)
SnippetsBelow is a list of all available snippets and the triggers of each one. The ⇥ means the TAB key. The ⏎ means the ENTER key. The ␣ means the SPACE key. MERN-Snippets 🤓Nestjs Snippets for Visual Studio Code. Using this extension you can quickly create Nestjs boilerplate code. 🚀 😎 Includes snippets for:
UsageThis VSCode extension is a collection of snippets for the nestjs framework.
CommandNestjs Snippets Commands using
|
Trigger | Content |
---|---|
nsctl-> |
Nestjs Controller |
nssql-> |
Sequelize Nestjs @nestjs/sequelize |
nssqlpr-> |
Nestjs Provider |
nstst-> |
Nestjs Test |
nsmg-> |
using mooogose @nestjs/mongoose |
nsmssvc-> |
Nestjs Service Mongoose |
nsrp-> |
Nestjs Repository |
nsent-> |
Entity Nestjs |
nsctexp-> |
Custom Exception Nestjs |
nse-> |
Nestjs Enum |
nsdto-> |
Nestjs DTO |
nsdtoup-> |
Update Nestjs DTO |
nsdtocreate-> |
Create Nestjs DTO |
nsdtoquery-> |
Query Nestjs DTO |
nsdtoquerypag-> |
Query Pagination Nestjs DTO |
nsdtoquerypagsortfil-> |
Query Pagination Sort Filter Nestjs DTO |
nsdtoquerypagsortfilsea-> |
Query Pagination Sort Filter Search Nestjs DTO |
nslgg-> |
Logger Nestjs |
nsctdec-> |
Decorator Nestjs |
nsjwtstr-> |
JWT Strategy Nest |
nspp-> |
Pipe Nestjs |
nsdmd-> |
Dni Module Nestjs |
nsflt-> |
Filter Nestjs |
nsprd-> |
Provider Nestjs |
nsgd-> |
Guard Nestjs |
nsitpr-> |
Interceptor Nestjs |
nsrtmd-> |
Root module Nestjs |
nsmdlwr-> |
Middleware Nestjs |
nsvc-> |
Service Nestjs |
nsmd-> |
Module Nestjs |
nsmdip-> |
Import Module Nestjs |
nsmdipadd-> |
Import Add Module Nestjs |
nstpcnn-> |
Typeorm Connection Nestjs |
nstprp-> |
Typeorm repository Nestjs |
nstprpimp-> |
Typeorm import repository Nestjs |
nsprismasvc-> |
Prisma Service Nestjs |
nsqlsrv-> |
Sequelize Service Nestjs |
nsmgsrcv2-> |
Mongo Service Nestjs |
nsswgg-> |
Swagger Nestjs |
nsjwt-> |
JWT Nestjs |
nsbcrt-> |
Bycrypt Nest |
nsmlr-> |
Mailer Nestjs |
nsvaldcll-> |
Class Validator Nestjs |
nsvalmthd-> |
Validation Method Nestjs |
Examples
Controller Example:
import { Controller, Get, Post, Put, Delete, Param, Body } from '@nestjs/common';
@Controller('$1')
export class $2Controller {
@Get()
findAll(): string {
return 'This action returns all $1';
}
@Get(':id')
findOne(@Param('id') id): string {
return 'This action returns a #${id} $1';
}
@Post()
create(@Body() $1Data): string {
return 'This action adds a new $1';
}
@Put(':id')
update(@Param('id') id @Body() $1Data): string {
return 'This action updates a #${id} $1';
}
@Delete(':id')
remove(@Param('id') id): string {
return 'This action removes a #${id} $1';
}
}
Express Snippets Commands using es
prefix
es + tab or enter
- command:
es
- description: Express Snippets
- prefix:
es
Trigger | Content |
---|---|
esr-> |
Express Router |
esrget-> |
Express Router Get |
esrpost-> |
Express Router Post |
esrput-> |
Express Router Put |
esrpatch-> |
Express Router Patch |
esrdelete-> |
Express Router Delete |
esrall-> |
Express Router All |
esruse-> |
Express Router Use |
esrparam-> |
Express Router Param |
esrparams-> |
Express Router Params |
esrquery-> |
Express Router Query |
esrhead-> |
Express Router Head |
esrpath-> |
Express Router Path |
esrroute-> |
Express Router Route |
esrstack-> |
Express Router Stack |
esrapp-> |
Express Router App |
esrparent-> |
Express Router Parent |
esrpath-> |
Express Router Path |
Examples
Express Router Example:
import express from 'express';
const router = express.Router();
router.get('/', (req, res) => {
res.send('Hello World!');
});
export default router;
Mongoose Snippets Commands using ms
prefix
ms + tab or enter
- command:
ms
- description: Mongoose Snippets
- prefix:
ms
Trigger | Content |
---|---|
msm-> |
Mongoose Model |
How to develop
- Clone the repository
- Open the repository in VS Code
- Run
npm install
- Run
npm run watch
- Press
F5
to open a new window with your extension loaded - Make changes to
src/extension.ts
or create new ones undersrc/
- You can reload the window with
Ctrl+R
or by clicking on the reload button in the debug toolbar - You can launch the extension from the debug toolbar with the green play button
- You can run tests from the debug toolbar with the blue play button
How to package
- Run
npm run package
- Find the
.vsix
file in thedist
folder - Install the
.vsix
file in VS Code by runningcode --install-extension <name>.vsix
- You can also install the
.vsix
file by opening the extensions view in VS Code and clicking on the...
menu in the top right corner of the view
Contributing
If you have any suggestions or find any bugs, please create an issue or pull request.
👨🚀 Author
👋 My Contacts:
Made with ❤️ by Estevam Souza
Contributors
Changelog
0.0.4
- Added Apollo GraphQL Snippets
- Added MISC Snippets
- Added React Snippets
0.0.3
- Added GraphQL Snippets
- Added MongoDB + Mongoose + Prism Snippets
- TypeORM + NestJS + Sequelize + TypeGraphQL + JWT + Bcrypt + Mailer + Class Validator + Swagger + Prisma + GraphQL + MongoDB + Mongoose + Apollo GraphQL + React + MISC Snippets
0.0.2
- Added more snippets ⚡️(Express)
- Added more documentation 📝
- Updated Docs 📖
0.0.1
- Initial release 🎉
Initial release of MERN snippets
Enjoy! 🎉🎊