Giter Site home page Giter Site logo

pnreddysvu / jhipster-backend-less Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gmarziou/jhipster-backend-less

0.0 2.0 0.0 372 KB

Shows how to configure a jhipster app for backend-less development. See README.md for details

JavaScript 23.95% Java 46.47% HTML 22.46% ApacheConf 6.21% CSS 0.92%

jhipster-backend-less's Introduction

jhipster backend-less development

This is an example on how to configure a jhipster application so that frontend can be developed without the backend.

It is well explained here.

Benefits are:

  • faster development cycle
  • easier communication with customers as you can zip the webapp folder and send it to them for review
  • easier collaboration with designers
  • less coupling between resources (REST API) and entities (JPA, database)

In this example, only a part of the backend API is simulated in src/main/webapp/scripts/app/stubs/httpBackendStub.js but enough to authenticate with user or admin accounts and to use the CRUD view of an entity.

Unfortunately, this approach is not compatible with great new feature added in 2.3.0: BrowserSync support because the way Gruntfile.js is configured in jhipster proxies any request to the jhipster application running on port 8080

My solution is to have 2 BrowserSync configurations:

  • dev: the original one that uses a proxy for all requests
  • backendLess: the new one that uses static server and works only with simulated backend

This is what is below, it could be improved by avoiding duplicating the list of files to watch.

        browserSync: {
            dev: {
                bsFiles: {
                    src : [
                        'src/main/webapp/**/*.html',
                        'src/main/webapp/**/*.json',
                        'src/main/webapp/bower_components/**/*.{js,css}',
                        '{.tmp/,}src/main/webapp/assets/styles/**/*.css',
                        '{.tmp/,}src/main/webapp/scripts/**/*.js',
                        'src/main/webapp/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
                    ]
                },
                options: {
                    watchTask: true,
                    server: {
                       baseDir: [".tmp", "src/main/webapp"]
                    }
                }
            },
            backendLess: {
                bsFiles: {
                    src : [
                        'src/main/webapp/**/*.html',
                        'src/main/webapp/**/*.json',
                        'src/main/webapp/bower_components/**/*.{js,css}',
                        '{.tmp/,}src/main/webapp/assets/styles/**/*.css',
                        '{.tmp/,}src/main/webapp/scripts/**/*.js',
                        'src/main/webapp/assets/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
                    ]
                },
                options: {
                    watchTask: true,
                    proxy: "localhost:8080"
                }
            },
        },

These 2 configurations are used by 2 tasks:

  • serve: the original one that uses BrowserSync:dev
  • serve-client: the new one that uses BrowserSync:backendLess
    grunt.registerTask('serve', [
        'clean:server',
        'wiredep',
        'ngconstant:dev',
        'concurrent:server',
        'browserSync:dev',
        'watch'
    ]);

    grunt.registerTask('serve-client', [
        'clean:server',
        'wiredep',
        'ngconstant:dev',
        'concurrent:server',
        'browserSync:backendLess',
        'watch'
    ]);

jhipster-backend-less's People

Contributors

gmarziou avatar

Watchers

James Cloos 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.