Git Product home page Git Product logo

app-router-examples's Introduction

app-router examples

Example app-router setup to get you running locally.

Download and un-zip the examples.

hash-routing

Hash routing uses hash paths /#/paths.

  1. Open a terminal in the hash-routing directory
  2. Start a static content server with node http-server or python -m SimpleHTTPServer 8080
  3. Open http://localhost:8080/

pushstate-routing

Push state routing uses regular paths /path and extends <a> tags with the pushstate-anchor.

<a is="pushstate-anchor" href="/home">Home</a>
  1. Open a terminal in the pushstate-routing directory
  2. Start the express.js server with node server.js
  3. Open http://localhost:8080/

Other Routers

Examples of app-router, flatiron-director, and plain old HTML files. https://github.com/erikringsmuth/polymer-router-demos

HTTP Server Pushstate Configurations

Examples of HTTP Server configurations to get pushstate working.

Apache .htaccess

Options +FollowSymLinks
IndexIgnore /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html

Nginx Conf - to be inserted in your server{} declaration

location / {
  try_files $uri @rewrites /index.html;
}
# If no asset matches, send it to your javascript app. Hopefully it's a route in the app!
location @rewrites {
  rewrite .* /index.html last;
}

app-router-examples's People

Contributors

erikringsmuth avatar ioneyed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app-router-examples's Issues

Absolute Path Example

Create separate examples for hash paths /#/path and regular paths /path. Regular paths require the server to always return index.html.

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.