mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Add with-featherjs example
This commit is contained in:
parent
c77fc45d9b
commit
ea31b09ee2
13
examples/with-featherjs/.editorconfig
Normal file
13
examples/with-featherjs/.editorconfig
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
35
examples/with-featherjs/.gitignore
vendored
Normal file
35
examples/with-featherjs/.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# Commenting this out is preferred by some people, see
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Users Environment Variables
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
lib/
|
||||||
|
data/
|
||||||
|
|
||||||
|
# Nuxt
|
||||||
|
.nuxt/
|
||||||
|
dist/
|
29
examples/with-featherjs/.jshintrc
Normal file
29
examples/with-featherjs/.jshintrc
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"node": true,
|
||||||
|
"esnext": true,
|
||||||
|
"bitwise": true,
|
||||||
|
"camelcase": true,
|
||||||
|
"curly": true,
|
||||||
|
"eqeqeq": true,
|
||||||
|
"immed": true,
|
||||||
|
"indent": 2,
|
||||||
|
"latedef": "nofunc",
|
||||||
|
"newcap": false,
|
||||||
|
"noarg": true,
|
||||||
|
"quotmark": "single",
|
||||||
|
"regexp": true,
|
||||||
|
"undef": true,
|
||||||
|
"unused": false,
|
||||||
|
"strict": false,
|
||||||
|
"trailing": true,
|
||||||
|
"smarttabs": true,
|
||||||
|
"white": false,
|
||||||
|
"globals": {
|
||||||
|
"it": true,
|
||||||
|
"describe": true,
|
||||||
|
"before": true,
|
||||||
|
"beforeEach": true,
|
||||||
|
"after": true,
|
||||||
|
"afterEach": true
|
||||||
|
}
|
||||||
|
}
|
30
examples/with-featherjs/.npmignore
Normal file
30
examples/with-featherjs/.npmignore
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# Commenting this out is preferred by some people, see
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Users Environment Variables
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
data/
|
22
examples/with-featherjs/LICENSE
Normal file
22
examples/with-featherjs/LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Feathers
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
0
examples/with-featherjs/NEDB_BASE_PATH/users.db
Normal file
0
examples/with-featherjs/NEDB_BASE_PATH/users.db
Normal file
52
examples/with-featherjs/README.md
Normal file
52
examples/with-featherjs/README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# with-featherjs
|
||||||
|
|
||||||
|
> Nuxt.js with FeatherJS
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
This project uses [Feathers](http://feathersjs.com). An open source web framework for building modern real-time applications.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Getting up and running is as easy as 1, 2, 3.
|
||||||
|
|
||||||
|
1. Make sure you have [NodeJS](https://nodejs.org/) and [npm](https://www.npmjs.com/) installed.
|
||||||
|
2. Install your dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Start your app
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Production
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Simply run `npm test` and all your tests in the `test/` directory will be run.
|
||||||
|
|
||||||
|
## Scaffolding
|
||||||
|
|
||||||
|
Feathers has a powerful command line interface. Here are a few things it can do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ npm install -g feathers-cli # Install Feathers CLI
|
||||||
|
|
||||||
|
$ feathers generate service # Generate a new Service
|
||||||
|
$ feathers generate hook # Generate a new Hook
|
||||||
|
$ feathers generate model # Generate a new Model
|
||||||
|
$ feathers help # Show all commands
|
||||||
|
```
|
||||||
|
|
||||||
|
## Help
|
||||||
|
|
||||||
|
For more information on all the things you can do with Feathers visit [docs.feathersjs.com](http://docs.feathersjs.com).
|
11
examples/with-featherjs/config/default.json
Normal file
11
examples/with-featherjs/config/default.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"host": "localhost",
|
||||||
|
"port": 3030,
|
||||||
|
"nedb": "../data/",
|
||||||
|
"auth": {
|
||||||
|
"token": {
|
||||||
|
"secret": "B/UmaCQUlnIn8lNq7h7KjkM5aqlRz+RkiZ/v3cPL72LYavj6d68HtxXfnrb5T70mdZxHjPNsNfBR7YE1sE6Hdg=="
|
||||||
|
},
|
||||||
|
"local": {}
|
||||||
|
}
|
||||||
|
}
|
11
examples/with-featherjs/config/production.json
Normal file
11
examples/with-featherjs/config/production.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"host": "with-featherjs-app.feathersjs.com",
|
||||||
|
"port": 80,
|
||||||
|
"nedb": "NEDB_BASE_PATH",
|
||||||
|
"auth": {
|
||||||
|
"token": {
|
||||||
|
"secret": "FEATHERS_AUTH_SECRET"
|
||||||
|
},
|
||||||
|
"local": {}
|
||||||
|
}
|
||||||
|
}
|
48
examples/with-featherjs/package.json
Normal file
48
examples/with-featherjs/package.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "with-featherjs",
|
||||||
|
"description": "Nuxt.js with FeatherJS",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"homepage": "",
|
||||||
|
"main": "src/",
|
||||||
|
"keywords": [
|
||||||
|
"feathers"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {},
|
||||||
|
"author": {},
|
||||||
|
"contributors": [],
|
||||||
|
"bugs": {},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.12.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "npm run jshint && npm run mocha",
|
||||||
|
"jshint": "jshint src/. test/. --config",
|
||||||
|
"dev": "DEBUG=nuxt:* node src/",
|
||||||
|
"build": "nuxt build",
|
||||||
|
"start": "NODE_ENV=production node src/",
|
||||||
|
"mocha": "mocha test/ --recursive --timeout=30000"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"body-parser": "^1.15.2",
|
||||||
|
"compression": "^1.6.2",
|
||||||
|
"cors": "^2.8.1",
|
||||||
|
"feathers": "^2.0.3",
|
||||||
|
"feathers-authentication": "^0.7.12",
|
||||||
|
"feathers-configuration": "^0.3.3",
|
||||||
|
"feathers-errors": "^2.5.0",
|
||||||
|
"feathers-hooks": "^1.7.1",
|
||||||
|
"feathers-nedb": "^2.6.0",
|
||||||
|
"feathers-rest": "^1.6.0",
|
||||||
|
"feathers-socketio": "^1.4.2",
|
||||||
|
"nedb": "^1.8.0",
|
||||||
|
"nuxt": "^0.9.5",
|
||||||
|
"passport": "^0.3.2",
|
||||||
|
"winston": "^2.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jshint": "^2.9.4",
|
||||||
|
"mocha": "^3.2.0",
|
||||||
|
"request": "^2.79.0"
|
||||||
|
}
|
||||||
|
}
|
16
examples/with-featherjs/pages/about.vue
Normal file
16
examples/with-featherjs/pages/about.vue
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<p>Hi from {{ name }}</p>
|
||||||
|
<nuxt-link to="/">Home page</nuxt-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data ({ req, isServer }) {
|
||||||
|
return {
|
||||||
|
name: req ? 'server' : 'client'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
6
examples/with-featherjs/pages/index.vue
Normal file
6
examples/with-featherjs/pages/index.vue
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h1>Welcome!</h1>
|
||||||
|
<nuxt-link to="/about">About page</nuxt-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
30
examples/with-featherjs/src/app.js
Normal file
30
examples/with-featherjs/src/app.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const compress = require('compression');
|
||||||
|
const cors = require('cors');
|
||||||
|
const feathers = require('feathers');
|
||||||
|
const configuration = require('feathers-configuration');
|
||||||
|
const hooks = require('feathers-hooks');
|
||||||
|
const rest = require('feathers-rest');
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
const socketio = require('feathers-socketio');
|
||||||
|
const middleware = require('./middleware');
|
||||||
|
const services = require('./services');
|
||||||
|
|
||||||
|
const app = feathers();
|
||||||
|
|
||||||
|
app.configure(configuration(path.join(__dirname, '..')));
|
||||||
|
|
||||||
|
app.use(compress())
|
||||||
|
.options('*', cors())
|
||||||
|
.use(cors())
|
||||||
|
.use(bodyParser.json())
|
||||||
|
.use(bodyParser.urlencoded({ extended: true }))
|
||||||
|
.configure(hooks())
|
||||||
|
.configure(rest())
|
||||||
|
.configure(socketio())
|
||||||
|
.configure(services)
|
||||||
|
.configure(middleware);
|
||||||
|
|
||||||
|
module.exports = app;
|
13
examples/with-featherjs/src/hooks/index.js
Normal file
13
examples/with-featherjs/src/hooks/index.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Add any common hooks you want to share across services in here.
|
||||||
|
//
|
||||||
|
// Below is an example of how a hook is written and exported. Please
|
||||||
|
// see http://docs.feathersjs.com/hooks/readme.html for more details
|
||||||
|
// on hooks.
|
||||||
|
|
||||||
|
exports.myHook = function(options) {
|
||||||
|
return function(hook) {
|
||||||
|
console.log('My custom global hook ran. Feathers is awesome!');
|
||||||
|
};
|
||||||
|
};
|
15
examples/with-featherjs/src/index.js
Normal file
15
examples/with-featherjs/src/index.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const app = require('./app');
|
||||||
|
const port = app.get('port');
|
||||||
|
|
||||||
|
process.on('nuxt:build:done', (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const server = app.listen(port);
|
||||||
|
server.on('listening', () =>
|
||||||
|
console.log(`Feathers application started on ${app.get('host')}:${port}`)
|
||||||
|
);
|
||||||
|
});
|
12
examples/with-featherjs/src/middleware/index.js
Normal file
12
examples/with-featherjs/src/middleware/index.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const nuxt = require('./nuxt');
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
// Add your custom middleware here. Remember, that
|
||||||
|
// just like Express the order matters, so error
|
||||||
|
// handling middleware should go last.
|
||||||
|
const app = this;
|
||||||
|
|
||||||
|
app.use(nuxt);
|
||||||
|
};
|
22
examples/with-featherjs/src/middleware/nuxt.js
Normal file
22
examples/with-featherjs/src/middleware/nuxt.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
const resolve = require('path').resolve;
|
||||||
|
const Nuxt = require('nuxt');
|
||||||
|
|
||||||
|
// Setup nuxt.js
|
||||||
|
let config = {};
|
||||||
|
try {
|
||||||
|
config = require('../../nuxt.config.js');
|
||||||
|
} catch (e) {}
|
||||||
|
config.rootDir = resolve(__dirname, '..', '..');
|
||||||
|
config.dev = process.env.NODE_ENV !== 'production';
|
||||||
|
const nuxt = new Nuxt(config);
|
||||||
|
if (config.dev) {
|
||||||
|
nuxt.build().then(() => {
|
||||||
|
process.emit('nuxt:build:done');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
process.nextTick(() => process.emit('nuxt:build:done'));
|
||||||
|
}
|
||||||
|
// Add nuxt.js middleware
|
||||||
|
module.exports = function (req, res) {
|
||||||
|
nuxt.render(req, res);
|
||||||
|
};
|
14
examples/with-featherjs/src/services/authentication/index.js
Normal file
14
examples/with-featherjs/src/services/authentication/index.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const authentication = require('feathers-authentication');
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
const app = this;
|
||||||
|
|
||||||
|
let config = app.get('auth');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app.configure(authentication(config));
|
||||||
|
};
|
11
examples/with-featherjs/src/services/index.js
Normal file
11
examples/with-featherjs/src/services/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
'use strict';
|
||||||
|
const authentication = require('./authentication');
|
||||||
|
const user = require('./user');
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
const app = this;
|
||||||
|
|
||||||
|
|
||||||
|
app.configure(authentication);
|
||||||
|
app.configure(user);
|
||||||
|
};
|
51
examples/with-featherjs/src/services/user/hooks/index.js
Normal file
51
examples/with-featherjs/src/services/user/hooks/index.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const globalHooks = require('../../../hooks');
|
||||||
|
const hooks = require('feathers-hooks');
|
||||||
|
const auth = require('feathers-authentication').hooks;
|
||||||
|
|
||||||
|
exports.before = {
|
||||||
|
all: [],
|
||||||
|
find: [
|
||||||
|
auth.verifyToken(),
|
||||||
|
auth.populateUser(),
|
||||||
|
auth.restrictToAuthenticated()
|
||||||
|
],
|
||||||
|
get: [
|
||||||
|
auth.verifyToken(),
|
||||||
|
auth.populateUser(),
|
||||||
|
auth.restrictToAuthenticated(),
|
||||||
|
auth.restrictToOwner({ ownerField: '_id' })
|
||||||
|
],
|
||||||
|
create: [
|
||||||
|
auth.hashPassword()
|
||||||
|
],
|
||||||
|
update: [
|
||||||
|
auth.verifyToken(),
|
||||||
|
auth.populateUser(),
|
||||||
|
auth.restrictToAuthenticated(),
|
||||||
|
auth.restrictToOwner({ ownerField: '_id' })
|
||||||
|
],
|
||||||
|
patch: [
|
||||||
|
auth.verifyToken(),
|
||||||
|
auth.populateUser(),
|
||||||
|
auth.restrictToAuthenticated(),
|
||||||
|
auth.restrictToOwner({ ownerField: '_id' })
|
||||||
|
],
|
||||||
|
remove: [
|
||||||
|
auth.verifyToken(),
|
||||||
|
auth.populateUser(),
|
||||||
|
auth.restrictToAuthenticated(),
|
||||||
|
auth.restrictToOwner({ ownerField: '_id' })
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.after = {
|
||||||
|
all: [hooks.remove('password')],
|
||||||
|
find: [],
|
||||||
|
get: [],
|
||||||
|
create: [],
|
||||||
|
update: [],
|
||||||
|
patch: [],
|
||||||
|
remove: []
|
||||||
|
};
|
35
examples/with-featherjs/src/services/user/index.js
Normal file
35
examples/with-featherjs/src/services/user/index.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const NeDB = require('nedb');
|
||||||
|
const service = require('feathers-nedb');
|
||||||
|
const hooks = require('./hooks');
|
||||||
|
|
||||||
|
module.exports = function(){
|
||||||
|
const app = this;
|
||||||
|
|
||||||
|
const db = new NeDB({
|
||||||
|
filename: path.join(app.get('nedb'), 'users.db'),
|
||||||
|
autoload: true
|
||||||
|
});
|
||||||
|
|
||||||
|
let options = {
|
||||||
|
Model: db,
|
||||||
|
paginate: {
|
||||||
|
default: 5,
|
||||||
|
max: 25
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initialize our service with any options it requires
|
||||||
|
app.use('/users', service(options));
|
||||||
|
|
||||||
|
// Get our initialize service to that we can bind hooks
|
||||||
|
const userService = app.service('/users');
|
||||||
|
|
||||||
|
// Set up our before hooks
|
||||||
|
userService.before(hooks.before);
|
||||||
|
|
||||||
|
// Set up our after hooks
|
||||||
|
userService.after(hooks.after);
|
||||||
|
};
|
BIN
examples/with-featherjs/static/favicon.ico
Normal file
BIN
examples/with-featherjs/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
38
examples/with-featherjs/test/app.test.js
Normal file
38
examples/with-featherjs/test/app.test.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const request = require('request');
|
||||||
|
const app = require('../src/app');
|
||||||
|
|
||||||
|
describe('Feathers application tests', function() {
|
||||||
|
before(function(done) {
|
||||||
|
this.server = app.listen(3030);
|
||||||
|
this.server.once('listening', () => done());
|
||||||
|
});
|
||||||
|
|
||||||
|
after(function(done) {
|
||||||
|
this.server.close(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('starts and shows the index page', function(done) {
|
||||||
|
request('http://localhost:3030', function(err, res, body) {
|
||||||
|
assert.ok(body.indexOf('<h1>Welcome!</h1>') !== -1);
|
||||||
|
done(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('404', function() {
|
||||||
|
it('shows a 404 HTML page', function(done) {
|
||||||
|
request({
|
||||||
|
url: 'http://localhost:3030/path/to/nowhere',
|
||||||
|
headers: {
|
||||||
|
'Accept': 'text/html'
|
||||||
|
}
|
||||||
|
}, function(err, res, body) {
|
||||||
|
assert.equal(res.statusCode, 404);
|
||||||
|
assert.ok(body.indexOf('This page could not be found.') !== -1);
|
||||||
|
done(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
10
examples/with-featherjs/test/services/user/index.test.js
Normal file
10
examples/with-featherjs/test/services/user/index.test.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const app = require('../../../src/app');
|
||||||
|
|
||||||
|
describe('user service', function() {
|
||||||
|
it('registered the users service', () => {
|
||||||
|
assert.ok(app.service('users'));
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user