Coder Social home page Coder Social logo

light's People

Contributors

kvengerov avatar

Watchers

 avatar

light's Issues

feat(db): add PostgreSQL db [WiP]

You need to do:

  • set dependencies

npm install --save @nestjs/typeorm typeorm pg

  • import module typeorm to app.module
  • config .env file
PORT=3000
DB_TYPE=postgres
DB_NAME=SVVS_DB
DB_HOST=localhost
DB_HOST_NAME=postgres
DB_PORT=5433
DB_USER_NAME=postgres
DB_USER_PASSWORD=123456
PGADMIN_PORT=5555
[email protected]
PGADMIN_DEFAULT_PASSWORD=admin
FRONTEND_CLIENT_PORT=4201
  • create database
    Docker
version: '3.1'

services:
  postgres:
    image: postgres:13-alpine
    hostname: ${DB_HOST_NAME}
    ports:
      - ${DB_PORT}:5432
    environment:
      POSTGRES_USER: ${DB_USER_NAME}
      POSTGRES_PASSWORD: ${DB_USER_PASSWORD}
      POSTGRES_DB: ${DB_NAME}
    volumes:
      - postgres-data:/var/lib/postgresql/data
    restart: unless-stopped
    networks:
      - backend

  pgadmin:
    image: dpage/pgadmin4
    depends_on:
      - postgres
    ports:
      - ${PGADMIN_PORT}:80
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
    restart: unless-stopped
    networks:
      - backend

volumes:
  postgres-data:

networks:
  backend:

Scripts

"db:start": "cp .env ./docker-compose && cd docker-compose && docker-compose up -d",
"db:stop": "cd docker-compose && docker-compose stop && rm .env",
  • connect database
    config
export const environment = {
  production: false,
  connection: {
    type: process.env.DB_TYPE,
    host: process.env.DB_HOST,
    port: process.env.DB_PORT,
    username: process.env.DB_USER_NAME,
    password: process.env.DB_USER_PASSWORD,
    database: process.env.DB_NAME,
    dropSchema: false,
    synchronize: true,
    logging: true,
    entities: [
      'dist/apps/backend/api/src/**/*.entity{.ts, .js}'
    ],
    migrations: [
      'dist/apps/backend/api/migrations/*{.ts, .js}'
    ],
    cli: {
      'migrationsDir': 'db/migrations'
    }
  }
};

feat(api): add GraphQL [WiP]

You need to do:

npm install @nestjs/graphql @nestjs/apollo apollo-server-express graphql-tools graphql

  • setup config and check working
  • connect playground

feat(api-auth): add authentication [WiP]

You need to do:

  • setup dependencies password
npm install graphql-type-json
npm install  @nestjs/passport passport @nestjs/jwt passport-jwt bcrypt
npm install  -D @types/passport-jwt
  • add shared library interfaces
  • create module users
  • create module auth
  • setup entities and migrations

tsconfig.entities.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../../dist",
    "types": ["node"],
    "target": "es5",
    "module": "commonjs"
  },
  "exclude": ["src/**/*.spec.ts"],
  "include": ["src/app/**/*entity.ts"]
}

tsconfig.migrations.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../../../dist",
    "types": ["node"],
    "target": "es5",
    "module": "commonjs"
  },
  "exclude": ["src/**/*.spec.ts"],
  "include": ["src/migrations/**/*.ts"]
}

scripts

"backend:api:entities": "node_modules/.bin/tsc --project apps/backend/api/tsconfig.entities.json",
"backend:api:migrations:run": "node_modules/.bin/tsc --project apps/backend/api/tsconfig.migrations.json && node_modules/.bin/ts-node node_modules/.bin/typeorm migration:run -t=false",
"backend:api:migration:create": "node_modules/.bin/ts-node node_modules/.bin/typeorm migration:create -n",
  • create migration for test user

генератор bcrypt

  • test functionality

настройка Data scalar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.