Giter Site home page Giter Site logo

ts-backend's Introduction

TS Backend

A template backend project using the library TSOA, a Typescript upgrade of express server that includes support for dependency injection. It also includes TypeORM.

Getting started

yarn
yarn dev

The project is based on TSOA.

API documentation

  • check http://localhost:9500/api-doc/ for testing.

Database configuration

Use MySQL Workbench. Connect to database as administrator. Right-click on empty space (bottom-left) below the listing of schemas. Choose Create schema.

  • Schema name: tsbackdb
  • Character set: utf8mb4

Create user tsbackuser Choose Users and Privileges, add new user (username + password, by pressing Add Account button) On user set in Schema privileges tab: Add entry button, select schema tsbackdb, set Select all (privileges), Apply.

Creation of the database on a server

sudo mysql
CREATE USER 'tsbackuser'@'localhost' IDENTIFIED BY '********';
create database tsbackdb
GRANT ALL PRIVILEGES ON tsbackdb.* TO 'tsbackuser'@'localhost';
FLUSH PRIVILEGES;

Development process

If controllers or types are changed run

yarn routes

If TypeORM entities are changed, run

yarn build

Migrations

Docs and tutorial

  • Migrations are stored in folder src/migration/.
  • To turn on migrations in file src/services/databaseService.ts set following: synchronize: false and migrationsRun: true.
  • To create a migration user following command typeorm migration:generate -n <nameOfMigrationFile> and new migration template will be created in folder src/migration/ .
    • Fill in up function with desired migration. Fill in down function with reversed migration or just simply put return.

ts-backend's People

Contributors

alenabelium avatar

Watchers

James Cloos avatar  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.