Coder Social home page Coder Social logo

ts-chat-app's Introduction

bruce_nodejs_project_template

如何使用?

  1. 進入專案目錄,先安裝node_module依賴
npm i
  1. 本地啟動專案
npm run dev

上線前編譯專案

npm run build

上線後,在機器上執行prod.ts

npm run start

本地開發總流程:

  1. 執行server端src/index.ts
  2. webpack起動編譯(做出main跟chatRoom頁面)
  3. 使用者在瀏覽器發起對應dev.ts裡的url請求
  4. sever回傳對應的頁面(由webpack編譯好的client頁面)

專案主要分成:

  • (client端)HTML5頁面
  1. npm run build -> 建立client資源
  2. 過程: 2-1. Webpack編譯TS+CSS+main.html -> Main頁面 2-2. Webpack編譯TS+CSS+chatRoom.html -> chatroom頁面
  • (Server端)Node Server
  1. 啟動express server

  2. 判斷當前process.env.NODE_ENV環境: 4-1 本地開發走dev.ts, 4-2 線上環境走prod.ts

  3. user從瀏覽器(client端)對Node Server請求頁面:

localhost:3000/main
localhost:3000/chatroom

dev.ts -> 重定向到main/main.html跟chatRoom/chatRoom.html
prod.ts -> 直接返回main/main.html跟chatRoom/chatRoom.html

```# ts-chat-app

ts-chat-app's People

Contributors

aki168 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.