blibli-future / detroit

Project Detroit
5 stars 0 forks source link

Feature/frontend stub #36

Closed adhikasp closed 7 years ago

adhikasp commented 7 years ago

This PR enable our project to build react js application.

We use npm to "compile" (technically it's transpiling) react js file in app.js into a runnable script in resource/bundle.js that our Spring project will read and serve them to user browser.

The NPM build process (build refer to the whole transpiling, minifying, etc) could be run automatically via maven command, thanks to frontend-maven-plugin

Before you can run this, there are few "installation" step required:

  1. Open cmd window and cd to detroit folder.
  2. Install node via mvn:frontend plugin mvn frontend:install-node-and-npm -DnodeVersion=v6.10.2
  3. Install library2 node (react, dll) mvn frontend:npm
  4. Ubah konfigurasi jalannya Spring agar melakukan build react terlebih dahulu
    • Edit konfigurasi DetroitApplication (klik dropdown di tempat jalanin app biasanya itu)
    • Di bagian paling bawah (Before launch), klik tanda +
    • Pilih run maven goal
    • Di bagian command line, isi dengan frontend:webpack
    • OK
    • Ubah posisinya agar item ini jadi nomor 1
  5. Jalankan project seperti biasanya
  6. Buka http://localhost:8080/view/, jika sukses akan ada tulisann Hello World