Adding an existing project to GitHub

1.Create a new repository on GitHub

2.Initialize the local directory as a Git repository

git init

3.Add the files in your new local repository

git add .

4.Commit the files that you’ve staged in your local repository

git commit -m "First commit"

5.In the Command prompt, add the URL for the remote repository where your local repository will be pushed

git remote add origin [remote repository URL]
git remote -v

6.Push the changes in your local repository to GitHub

git push origin master

Adding an existing project to GitHub

Angular – Routing reload 404 error

目前是利用繼承 OncePerRequestFilter 並覆寫 doFilterInternal 的方式來修正:

public class Html5ModeUrlSupportFilter extends OncePerRequestFilter {

    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
            FilterChain filterChain) throws ServletException, IOException {
        if (isStatic(request) || isApi(request)) {
            filterChain.doFilter(request, response);
        } else {
            request.getRequestDispatcher("/index.html").forward(request, response);

    private boolean isApi(HttpServletRequest request) {
        return request.getRequestURI().indexOf("/api/") >= 0;

    private boolean isStatic(HttpServletRequest request) {
        return Pattern.matches(".+\\.((html)|(css)|(js)|(map))$", request.getRequestURI());

若非 api request 也非靜態資源 request,則皆導到 index.html 來處理




Angular – Routing reload 404 error