Giter Club home page Giter Club logo

clientservice's Introduction

boot-microservice-gui

This is an extension of the non-GUI boot-microservice. To read about the backend side, please refer to boot-microservice README

GUI

The webapp is generated by yeoman using the angular generator.

It uses grunt that will automatically 'compile' your whole application, allowing cool dev mode with live reloads.

Inside you will find bower for javascript dependency management and node with npm that grunt uses.

Development mode

Before first use, build your whole application with gradle build. It will download auto-magically all npms and bower dependencies.

Then run you application (for example from Idea, just run main in com.ofg.twitter.Application specifying the correct -Dspring.profiles.active).

Now your application (backend) works. But you still need js+html. And since this is 2014, you don't just write html anymore, you have to use a shitload of libs :)

Install npm if you don't have it already. For example on Debian-based linux run:

sudo apt-get install npm

Then install grunt.

sudo npm install -g grunt-cli

And now make a symbolic link, because nodejs from Debian repos has a wrong name

ln -s /usr/bin/nodejs /usr/bin/node

Finally go to src/main/web and type grunt serve. This will run a local webserver on port 9000, your application will automatically open in the browser and from now on on every change in you webapp the browser will automatically refresh (no need to hit cmd-R all the time!).

Easy, right? Writing HTML in 2014 is simple... nooooot! :D

Production mode

When you build your application there is a special directory src/main/web/dist created, where grunt puts your minified, compacted and production-ready application. Then the whole folder will be bundled in your jar's static folder which will make it available when you run the jar.

Calling your microservice REST services

Once you expose some REST services on your backend, you will probably want to call them from Angular.

To make it possible in the Development mode, you will have to expose them via proxy (your dev page is available on port 9000 while the app is on 8080, remember?). Look into src/main/web/Gruntfile.js and inside connect you will have proxies section like this

connect: {
            proxies: [
                {context: '/info', host: 'localhost', port: 8080},
                {context: '/city', host: 'localhost', port: 8080},
                {context: '/api', host: 'localhost', port: 8080}
            ],

Just add whatever you wish. If you don't like exposing every service explicitly, you can expose them all in spring under some common path like /rest, and then you have to specify only the /rest in the proxy.

Cleaning npm and bower deps

Type gradle cleanGUIDeps

Build status

Build Status Coverage Status

clientservice's People

Contributors

dst avatar jakubnabrdalik avatar kamilszymanski avatar marcingrzejszczak avatar nurkiewicz avatar szimano avatar tdziurko avatar

Watchers

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