Git Product home page Git Product logo

lucksd356 / flask-angular-universal-demo Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 6.0 295 KB

Starter web application project with Angular Universal frontend and Flask RESTapi backend

License: MIT License

Batchfile 0.67% Python 20.46% CSS 8.04% HTML 17.66% TypeScript 47.58% JavaScript 5.59%
flask flask-restapi prerendering ng-bootstrap server-side-rendering angular-cli angular angular-universal bootstrap-navdropdown angular-sample-app

flask-angular-universal-demo's Introduction

Flask Angular-Universal Demo

This project has not been updated to be compatible with the latest version of Angular Universal.

Starter web application project with Angular Universal frontend and Flask RESTapi backend ngudemo

alt text

Built with components from the following projects

Requirements

  • python 3.6
  • Flask
  • Flask-SQLAlchemy
  • Node.js
  • npm
  • Angular 8
  • Angular Universal 8

Get Started

  • Create a virtual environment for python 3.6+ using either conda or virtualenv
  • Install Flask and other requirements per requirements.txt
  • Install Node.js
  • Clone this repo

git clone --depth 1 https://github.com/lucksd356/Flask-Angular-Universal-Demo.git

  • Change to the download directory and run the Flask app

python runserver.py

  • Create and seed the db (the server must still be running, so open a new terminal window first)

python manage.py create_db && python manage.py seed_db --seedfile ./data/db_items.json

Open a new terminal window, change to the ngclient directory and install dependencies:

npm install

Development (Client-side only rendering)

  • run npm run start which will start ng serve

Production (also for testing SSR/Pre-rendering locally)

npm run build:ssr && npm run serve:ssr - Compiles your application and spins up Node Express to serve your Universal application on http://localhost:4000.

npm run build:prerender && npm run serve:prerender - Compiles your application and prerenders your applications files, spinning up a demo http-server so you can view it on http://localhost:8080 Note: To deploy your static site to a static hosting platform you will have to deploy the dist/browser folder, rather than the usual dist

Additional Notes

  1. Change the host address for Flask RESTapi:

    • Edit target in proxy.config.json
    • Edit the proxy address for the serve:prerender command in package.json
  2. Edit static.paths.ts to specify routes for prerendering

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.