Coder Social home page Coder Social logo

expresstypescript's Introduction

EXPRESS TYPESCRIPT


INIT PACKAGE

npm install

NPM SCRIPT

Start Server with nodemon(ts-node)

npm run dev ( nodemon ts-node ./src/app.ts )

TypeScript Compile (Configuration file-./tsconfig.json)

npm run build ( tsc )

Copy NOT TypeScriptfiles

npm run copy ( copyfiles -u 1 "src/*/!(.ts)" dist )

Delete Compile Output Folder

npm run clean ( rimraf dist/)

Start Server

npm start ( npm run clean && npm run build && npm run copy && npm dist/app.js )

ENVIRONMENT VARIABLES

  • GOOGLE_APPLICATION_CREDENTIALS google api keyfile path

  • NODE_ENV development || test || deploy ...

  • EXPRESS_PORT

node-media-server

  • RTMP_PORT
  • HTTP_PORT

Server Route

(index page)
├──── /signin (user login)
├──── /signup (user sign up)
[       Require Json WebToken       ]
├──── /logout (user logout)
├──── /tl (google translate api)
└──── /navi (kakao maps api)
[       Require Json WebToken     ]
/member
├──── /info (info view)
└──── /modify (POST info modify)
[       Require Json WebToken       ]
/admin
└──── /menu
      │ /admin
      │     ├──── /list (admin list)
      │     ├──── /token
      │     │       └──── /list (admin token list)
      │     └──── /log
      │             ├──── /login (login request log)
      │             └──── /action (admin action log)
      └ /member
            ├──── /list (member list)
            │──── /token
            │       └──── /list (member token list)
            └──── /log
                    └──── /login (login request log)

Server directory (./src)

src
├──── config (private config files...like env...)
│    └──── winstone.ts (Logger module)
├──── [log] (Process log out put...)
├──── [media] (Stream server output directory)
│    └──── [live] (Stream output app config directory)
│         └──── [STREAM_ID] (Stream ID output directory)
├──── middlewares (middleware module)
│    ├──── Some
│    ├──── Thing
│    ├──── Nested
│    └──── Modules
│         ├──── index.ts
│         ├──── Some.ts
│         └──── Module.ts
├──── models (Database tables model - sequelized model)
│    ├──── Some
│    ├──── Thing
│    ├──── Nested
│    └──── Modules
│         ├──── index.ts
│         ├──── Some.ts
│         └──── Module.ts
├──── public (Server static files)
│    ├──── js (javascript files)
│    ├──── css (css files)
│    └──── something ( another files like png, jpg ...)
├──── routes (Server routers modules)
│    ├──── Some
│    ├──── Thing
│    ├──── Nested
│    └──── Modules
│         ├──── index.ts
│         ├──── Some.ts
│         └──── Module.ts
├──── socket (Socket.io modules, middlewares..etc)
├──── [uploads]
├──── utils (Util modules)
├──── views (view files like html...)
│    ├──── Some
│    └──── Directory
│         ├──── include ( common files... header,footer...)
│         ├──── Some
│         └──── Directory
[.env] (environment files - dotenv library, Don't commit this file)
app.ts (Express server)
rtmpServer.ts (node-media-server transmuxing server file)
sequelize.ts (Sequelize-typescript Configuration file)
webSocket.ts (Socket.io middle ware root index file)

Configuration files

ES-LINT ([projectDir]/.eslintrc)

{
    "env": {
        "browser": true,
        "es6": true, //transfiling support es6, if you want, can change options
        "node": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended"
    ],
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 2018,
        "sourceType": "module"
    },
    "plugins": ["@typescript-eslint"],
    "rules": {}
}

Prettier ([ProjectDir]/.pretterrc)

{
    "tabWidth": 4,
    "overrides": [
        {
            "files": ["*.html"],
            "options": {
                "printWidth": 120
            }
        }
    ]
}

Reference by

https://velog.io/@velopert/eslint-and-prettier-in-react

Sequelize (Database ORM MYSQL)

sequelize-typescript https://github.com/RobinBuschmann/sequelize-typescript#type-safe-usage-of-auto-generated-functions

sequelize (native) https://sequelize.org/v5/

Socket.io

https://socket.io/

node-media-server

https://github.com/illuspas/Node-Media-Server

construction

rtmp-server

  • rtmp-handshake
  • rtmp-session
  • rtmp-connect
  • rtmp-disconnect
  • rtmp-error

http-server

  • Express
  • Websocket
  • etc...

transmuxing

  • node exec ffmpeg command...

ffmpeg

https://ffmpeg.org/

expresstypescript's People

Contributors

jungdoo95 avatar ddudooo avatar sil-jdlee 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.