Giter VIP home page Giter VIP logo

node-express-demo's Introduction

WebAPIとWebページを起動するテンプレートアプリ

  • DDDアーキテクチャ
  • TypeScript で開発
  • src => dist にjsとhtmlを出力
  • dist/server.js からサーバー起動

参考サイト

// expressの開発にTypeScriptを利用する https://qiita.com/zaburo/items/69726cc42ef774990279

// コーディング規約 https://qiita.com/kabosu3d/items/06ce9266bc2db1226421 https://maasaablog.com/development/frontend/typescript/5078/

コマンドメモ

// package.json に記載されたモジュールをインストール npm install

// サーバー起動(apiのみ) npx ts-node server.ts

ビルド&サーバー起動の手順

  1. distフォルダに存在するフォルダとファイルを削除 del /f /s /q dist\. > nul for /d %x in (dist\*) do @rd /s /q %x > nul

  2. tsフォルダをビルド tsc

  3. htmlファイルをビルド(コピー) xcopy /E /I src\interfaces\web\pages\.html dist\interfaces\web\pages\.html

  4. distのエンドポイントを起動 node ./dist/server.js

上記1-4を実行するコマンド(package.jsonで定義) npm run start

テスト用

curl -X POST -d '{"WorkerGroupCode":"D","WorkerGroupName":"メテオ"}' http://localhost:3000/api/worker-group-mst

$jsonBody = '{"workerGroupCode":"D","workerGroupName":"メテオ"}' | Out-String $utf8Bytes = [System.Text.Encoding]::UTF8.GetBytes($jsonBody) $response = Invoke-RestMethod -Method Post -Uri "http://localhost:3000/api/worker-group-mst" -Body $utf8Bytes -ContentType 'application/json; charset=utf-8'

$uri = "http://localhost:3000/api/worker-group-mst?workerGroupCode=D&workerGroupName=テスト" Invoke-RestMethod -Method DELETE -Uri $uri -ContentType "application/json; charset=utf-8"

node-express-demo's People

Contributors

atman-33 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.