当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

spa-starter-kit

授权协议 MIT License
开发语言 PHP
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 丁晋
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Codecast's Single Page Application Starter Kit

A highly opinionated Single Page Application starter kit built on top of Vue.js and Laravel.

This package contains two separate projects to act as a starting point for a Single Page Application: a Vue.js project (created with vue-cli + webpack template) and a Laravel 5.3 project.

They're not just freshly created projects but a fully working application that can be modified and expanded to become your own application.

Demo

The live demo can be found in https://spa.codecasts.rocks/.

Features

  1. Client side
    • Vue.js 2.0 project create with vue-cli + webpack template
    • Centralized state management with Vuex
    • Route management with Vue-router
    • Authentication with JWT
    • Keep user signed in using local stored info
    • HTTP requests with Axios
    • ESLint with AirBNB preset
    • Pagination integrated with Laravel's LengthAwarePaginator
    • Alerts and Confirmation Alerts provided by SweetAlert
  2. Server side

Prerequisites

Make sure you have installed Node and Yarn (latest versions) as well as PHP 7 and MySQL.

Installation

Cloning

These commands will download the repository and prepare it for you.

git clone --depth 1 -b master git@github.com:codecasts/spa-starter-kit.git
cd spa-starter-kit
rm -rf ./.git/
git init
git add --all
git commit -m "init"

Setup

  1. Client side - this is a Vue.js project created with vue-cli
    • With Terminal cd client && yarn && yarn run dev.
  2. Server side - this is a Laravel 5.3 project
    • With Terminal:
      • Navigate to webservice folder and then:
      • composer install to install Laravel and third party packages
      • touch database/database.sqlite to create an empty database file
      • cp .env.example .env to configure installation
      • php artisan key:generate to generate unique key for the project
      • php artisan jwt:secret to generate unique key for the project
      • php artisan migrate to create all the tables
      • php artisan db:seed to fill the tables with fake data
      • php artisan serve to serve application on localhost:8000

Usage

  1. Client side
  2. Server side
    • API endpoint is http://localhost:8000/api

Testing

Navigate to webservice folder and run the composer test script

$ composer test

Things worth mentioning

  1. Error handling is done globally by making use of Axios' interceptors. But you can still .catch() errors within components to perform actions related to that scope. See /client/src/plugins/http.js;

  2. The same way error messages lives in one single component (/client/src/modules/general/alerts.vue) and their visibility is controlled by a Vuex property. So to show/hide messages it is just a matter of dispaching a Vuex action from within any component;

  3. The spinner displayed during server requests (see top right close to user indentification) is also controlled by a Vuex property. The procedure to show/hide it is the same as outlined in the item 2 above;

  4. routes and Vuex modules live close to the modules they work for. Always look for routes.js and store.js inside a module directory. See /client/src/modules/categories;

  5. Important: Laravel project found in the directory webservice was modified beyond adding routes and controllers. For instance: the webservice/app/Exceptions/Handler.php was modified from its original version to return all exceptions to the client, not only HttpExceptions. Other changes are also in place. So our recommendation is to always use this project to build your own, instead of copying controllers and routes to a new project.

Contributing

  1. Fork it!
  2. Create your feature branch from develop: git checkout -b feature/my-new-feature
  3. Write your code. Comment your code.
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin feature/my-new-feature
  6. Submit a pull request to develop branch :D

Credits

Fábio Vedovelli and dedicated contributors.

License

Licensed under the MIT license.

  • 最近终于开始看 m$ 的中文 webcast 。因为公司里用的是 "imp": echo + ofbiz (service) + eclipse(plugins) + ... 的框架结构的 web 体系,和 asp.net 有很大的相似性,所以就从 asp.net 的相关教程开始。 asp.net 有若干个 starter kit ,个人准备一个个先跑一下子。 Starter Kits http:

  • 写了一上午,把web.config写了出来,不过没保存成功~~痛苦啊!! 有兴趣的看一下这个帖子吧...虽然没有我写的全面..但...总比没写出来的好吧... http://dev.yesky.com/SoftChannel/72342380468043776/20050118/1902523.shtml 痛苦啊...一上午的心血...

  • Sprite Kit提供了很强大的Action功能,而且使用起来非常方便,对于SKAction,自己没什么好说的,做了一个demo之后,大概的东西都掌握了,还是得自己动手去做,这样才能学得更好,学得更快。具体的关于SKAction的东西可以去看官方的api,建议还是去看一看会比较好,里面说得很清楚。   这里主要说一些比较特别的地方。   有些Action函数只适用在SpriteSKNode,如s

 相关资料
  • SPA

    概述 SPA是为构建WebApp设计的路由控制和视图转换框架 SPA专注于解决构建WebApp时遇到的共性问题,尤其适用于构建MobileApp, 我们和jQuery Mobile、Sencha Touch等框架不同, 并不是一个构建移动端应用的前端整体解决方案,所以我们不包含UI组件,如果你不想自己设计界面, 可以用Bootstrap、Topcoat等UI Components框架配合SPA,

  • ANTD-SPA React+Antd后台管理系统 效果图 快速开始 1.克隆项目 git clone git@github.com:zhaoyu69/antd-spa.git 2.安装客户端依赖 cd clientnpm i 3.运行客户端 npm run start 4.安装服务端依赖 cd ../servernpm i 5.运行服务端 npm run start

  • 本软件是用来创建一个托管静态web页面的服务,目标是使单页应用部署简便、开销少、性能高。 基于 Hyper 和 warp 构建。 SSL 基于 Rustls。 服务器端缓存、客户端缓存(Cache-Content)、Gzip压缩。 SPA 版本管理, 仅需要一个 http 请求就能实现版本回滚和更新。 支持热更新(Mac and Linux)。 支持 CORS 跨域 http/https 同时服务

  • 用Knockout, Require, Director, jQuery, Sugar搭建的单页程序(SPA Single Page Application)框架。 特征 快速,轻巧(缩小了100 KB的JS,并压缩为初始内核设置)。 使用Knockout 3.4.0+,可以使用Knockout的Web组件和自定义标签。 组件文件(html,js,css)按需动态加载:仅当组件位于视图中时。 提供

  • SPA vs MPA 单页面应用(SinglePage Web Application,SPA) 多页面应用(MultiPage Application,MPA) 组成 一个外壳页面和多个页面片段组成 多个完整的页面构成 资源共用(js,css) 共用,只需要在外壳部分加载 不共用,每个页面都需要加载 刷新方式 页面局部刷新或更改 整页刷新 url模式 a.com/#/pageone a.com/

  • vue-spa-project 基于vue.js技术栈,采用MVC等分层结构设计、数据解耦设计、组件化和自动化构建的单页应用项目。 技术栈 vue.js(2.4) vuex(状态管理) vue-router(前端路由,异步加载) fetch(替代ajax,更高效地进行网络请求) element-ui(基于vue的PC端UI组件库) Webpack(自动构建) Babel预编译(ES6、SCSS等)