Giter Site home page Giter Site logo

news-api's Introduction

Установка

Убедиться, что на машине установлена PostgreSQL

Создать .env со своими данными по образцу .env.example. Затем:

yarn

или

npm i

После чего запустить миграции:

yarn typeorm -d .\migrations\migrations-config.ts migration:run

или

npm run typeorm migration:run -- -d .\migrations\migrations-config.ts

После чего возможно запустить приложение:

yarn start:dev

или

npm run start:dev

Доступные машруты

  localhost:3000/auth/register POST

  body: {
    "email": "[email protected]",
    "password": "strongPASS1"
  }
  localhost:3000/auth/login POST

  body: {
    "email": "[email protected]",
    "password": "strongPASS1"
  }
  localhost:3000/auth/refresh POST
  localhost:3000/auth/logout POST
  localhost:3000/news GET
  localhost:3000/news POST

  body: {
    "title": "news title",
    "text": "news text"
  }
  localhost:3000/news/:id PATCH

  body: {
    "title": "new title",
    "text": "new text"
  } - оба поля опциональны
  localhost:3000/news/:id DELETE

Описание .env параметов:

APP_HOST=имя-хоста

APP_PORT=порт

DB_USERNAME=имя-пользователя-БД

DB_PASSWORD=пароль-пользователя-БД

DB_DATABASE=имя-БД

DB_HOST=имя-хоста-БД

DB_PORT=порт-БД

ACCESS_TOKEN_EXPIRATION_TIME=время-действия-токена-доступа

ACCESS_TOKEN_SECRET=секрет-токена-доступа

REFRESH_TOKEN_EXPIRATION_TIME=время-действия-токена-обновления

REFRESH_TOKEN_SECRET=секрет-токена-обновления

news-api's People

Contributors

twtzptr avatar

Watchers

 avatar

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.