izmjs

VSCode Snippets

Controller Snippets

Add controller documentation doc:ctrl

1/**
2 * $1
3 * @controller $2,
4 * @param {Express.Request} req The request
5 * @param {OutcommingMessage} res The response
6 * @param {Function} next Go to the next middleware
7 */

Add controller documentation ctrl

1/**
2 * $1
3 * @controller $2
4 * @param {Express.Request} req The request
5 * @param {OutcommingMessage} res The response
6 * @param {Function} next Go to the next middleware
7 */
8exports.$3 = async function $3(req, res, next) {
9 $4;
10};

Response Format resp

1{
2 success: $1,
3 result: {$2}
4}

IAM Snippets

Create an IAM iam

1/**
2 * @type { IAM.default }
3 */
4module.exports = {
5 prefix: "/",
6 routes: [
7 {
8 path: "/",
9 methods: {
10 get: {
11 iam: "",
12 title: "",
13 groups: [],
14 parents: [],
15 description: "",
16 middlewares: [],
17 },
18 },
19 },
20 ],
21};

Create an IAM Route iam:route

1{
2 path: '/',
3 methods: {
4 get: {
5 iam: '',
6 title: '',
7 groups: [],
8 parents: [],
9 description: '',
10 middlewares: [
11
12 ],
13 },
14 },
15}

Create an IAM Method iam:method

1get: {
2 iam: '',
3 title: '',
4 groups: [],
5 parents: [],
6 description: '',
7 middlewares: [
8
9 ],
10},

Model Snippets

Create a Model iam:model

1/**
2 * Module dependencies.
3 */
4const { Schema, model } = require("mongoose");
5const { resolve } = require("path");
6
7const { timestamps } = require("@config/index").lib.mongoose;
8
9const Schema = new Schema(
10 {
11 title: String,
12 },
13 {
14 timestamps,
15 }
16);
17
18module.exports = model("", Schema);
Edit this page on GitHub