GithubHelp home page GithubHelp logo

wooodhead / gom-ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hecsalazarf/gom-ui

0.0 0.0 0.0 1.75 MB

Gom (Graph order management) UX

Shell 0.27% JavaScript 29.59% HTML 0.84% Vue 67.90% Dockerfile 0.06% Stylus 1.33%

gom-ui's Introduction

Gom UX

Description

Gom (Graph Order Management) is a small, yet powerful solution, built on top of Quasar Framework, for managing orders . Our target business is direct selling. However, it might apply to other scenarios.

Prerequisites

Gom API deployment

Node.js >= 8.9.0

npm >= 5.6.0

Installation

$ npm install

Running the app

Below command starts a Node.js local development server:

$ npx quasar dev -m pwa

For a full list of options, check Quasar command list.

Gom needs an HTTPS connection to work properly with all included features. Generate TLS certificates either for development (see certs folder) or production environments (let's encrypt).

Deployment

To generate a production-ready bundle, execute the following command:

$ npm run build

You can use any web server to serve these static files. Just consider that you have to add a catch-all fallback route to your server, since Gom uses Vou Router in history mode.

For example, with Nginx, you could do this:

location / {
  try_files $uri $uri/ /index.html =404;
}

Proxy

Gom communicates with its backend through a proxy. All endpoints under the /api/ route are proxied to the Gom API, including web socket connections.

On development environments, Quasar utilizes http-proxy-middleware which is configurable in quasar.conf.js.

module.exports = function (ctx) {
  return {
    devServer: {
      proxy: {
        // proxy all requests starting with /api
        '/api': {
          target: 'http://172.18.0.1:3000',
          changeOrigin: true,
          ws: true, // proxy websockets
          pathRewrite: {
            '^/api': ''
          },
          xfwd: true // add x-forward headers
        }
      }
    }
  }
}

On production, refer to your web server configuration. Nginx can be set up the following way:

# The trailing slash in proxy_pass is what makes a difference. It also ensures that
# proxy_redirect stays at default, so, you could still use 302 et al within your 
# backend, and have it work correctly everywhere.
location = /api {
  # Path rewrite
  return 302 /api/;
}
location /api/ {
  # Proxy pass 
  proxy_pass <GOM_API_SERVER>;
  proxy_buffering off;
  proxy_set_header X-Real-IP $remote_addr;
  # Express required headers when 'trust proxy' is enabled
  proxy_set_header X-Forwarded-For $realip_remote_addr;
  proxy_set_header X-Forwarded-Host $hostname;
  proxy_set_header X-Forwarded-Proto $scheme;
  # Support web sockets
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
}

Also observe that you can have Quasar serve command, supplied by the @quasar/cli package, act as a production static web server. Adjust the proxy configuration in proxy.conf.js, which esentially exposes the same properties as of quasar.conf.js. Then simply run:

$ npm run serve:build

Configuration variables

Configuration is done by adding variables to the process.env object. They are located in env.js and grouped in three categories: def (default), development and production. During the build process, we merge them depending on the target build.

  • CHROME_V: Minimum required version of Chrome.
  • SAFARI_V: Minimum required version of Safari.
  • FIREFOX_V: Minimum required version of Firefox.
  • CSRF_TOKEN_COOKIE: Cookie name for the CSRF token.
  • SESSION_TOKEN_COOKIE: Cookie name for the session token.
  • VAPID_PUBLIC_KEY: Public key to verify push notifications according to the VAPID specification.
  • WS_ENDPOINT: Web socket endpoint.

Authors

  • Héctor Salazar - hecsalazarf

Acknowledgments

Thanks to anyone whose code was used. This project is built on top of talented programmers' work; I just put the pieces together.

gom-ui's People

Contributors

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