liyanlong / nuxt-egg

Nuxt.js + Egg FrameWork

Home Page:http://nuxt-egg.liylblog.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Egg-Nuxt

Egg + Nuxt.js = πŸ”₯

NPM version build status Test coverage David deps npm download lincense image

Requirement

  • node >= 6.0.0

Quick Usage

$ npm install -g vue-cli
$ vue init nuxt-egg/starter my_project
or 
$ npm install -g egg-init
$ egg-init --package=egg-boilerplate-nuxt my_project

$ cd my_prject
$ npm install
$ npm run dev

Direct Structure

Look at egg-framework

nuxt-egg-project
β”œβ”€β”€ .nuxt
β”œβ”€β”€ resources
|   β”œβ”€β”€ pages
β”‚   β”œβ”€β”€ assets
β”‚   |   └── css
β”‚   |   └── img
β”‚   β”œβ”€β”€ static
β”‚   β”œβ”€β”€ layouts
β”‚   β”œβ”€β”€ middleware
β”‚   β”œβ”€β”€ plugins
β”‚   β”œβ”€β”€ components
β”œβ”€β”€ package.json
β”œβ”€β”€ app.js (option)
β”œβ”€β”€ agent.js (option)
β”œβ”€β”€ app
|   β”œβ”€β”€ router.js
β”‚   β”œβ”€β”€ controller
β”‚   |   └── home.js
β”‚   β”œβ”€β”€ service (option)
β”‚   |   └── user.js
β”‚   β”œβ”€β”€ middleware (option)
β”‚   |   └── response_time.js
β”‚   β”œβ”€β”€ schedule (option)
β”‚   |   └── my_task.js
β”‚   β”œβ”€β”€ public (option)
β”‚   |   └── reset.css
β”‚   β”œβ”€β”€ view (option)
β”‚   |   └── home.tpl
β”‚   └── extend (option)
β”‚       β”œβ”€β”€ helper.js (option)
β”‚       β”œβ”€β”€ request.js (option)
β”‚       β”œβ”€β”€ response.js (option)
β”‚       β”œβ”€β”€ context.js (option)
β”‚       β”œβ”€β”€ application.js (option)
β”‚       └── agent.js (option)
β”œβ”€β”€ config
|   β”œβ”€β”€ plugin.js
|   β”œβ”€β”€ config.default.js
β”‚   β”œβ”€β”€ config.prod.js
|   β”œβ”€β”€ config.test.js (option)
|   β”œβ”€β”€ config.local.js (option)
|   └── config.unittest.js (option)
└── test
    β”œβ”€β”€ middleware
    |   └── response_time.test.js
    └── controller
        └── home.test.js

Nuxt.js Changes

  • The Nuxt config file is now in config.[dev].js, dev allow set default, unittest, local, prod
  • The Nuxt project directory is resources (default)

config.default.js

const path = require('path');
exports.nuxt = {
  srcDir: path.join(__dirname, '../resources'),
  rootDir: path.dirname(__dirname),
}

Or you can also do this

// config/config.default.js
exports.nuxt = require('./config.nuxt.js');

// config/config.nuxt.js
module.exports = {
  srcDir: ''
  rootDir: ''
}

Live Demo

Documentation

Licenses

Note

  • egg-init doesn't support download image now, so the logo.png will not be open normal.

About

Nuxt.js + Egg FrameWork

http://nuxt-egg.liylblog.com/

License:MIT License


Languages

Language:JavaScript 100.0%