Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit494c4b2

Browse files
committed
Adding test, update version and README
1 parent49ae8ee commit494c4b2

File tree

5 files changed

+83
-13
lines changed

5 files changed

+83
-13
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.build*
2+
.npm

‎README.md‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#`ssr-wpo:meteor-koa`
2+
[Koa](http://koajs.com/) next generation web framework with Meteor
3+
4+
##Table of contents
5+
-[Installation](#installation)
6+
-[Api](#api)
7+
-[Example](#example)
8+
-[Additional koa packages](#additional)
9+
-[Testing](#testing)
10+
11+
##<aname='installation'>Installation</a>
12+
```bash
13+
$ meteor add ssr-wpo:meteor-koa
14+
```
15+
16+
##<aname='api'>Api</a>
17+
See[koa api](https://github.com/koajs/koa/tree/v2.x) for more details.
18+
19+
##<aname='example'>Example</a>
20+
`meteor-koa` is only available on server side. (`Meteor.isServer`)
21+
22+
```javascript
23+
import {koa }from'meteor/ssr-wpo:meteor-koa';
24+
25+
constapp=koa();
26+
27+
app.use((ctx)=> {
28+
ctx.body='Hello World';
29+
});
30+
```
31+
32+
##<aname='additional'>Additional koa packages</a>
33+
Koa has many additional packages listed[here](https://github.com/koajs/koa/wiki).
34+
35+
You can use them with`meteor-koa`, just simply add them with`npm` in your meteor project:
36+
```bash
37+
$ meteor npm install<koa-plugins>
38+
```
39+
40+
##<aname='testing'>Testing</a>
41+
```bash
42+
$ meteor test-packages ./ --driver-package practicalmeteor:mocha
43+
```
44+
###With[spacejam](https://www.npmjs.com/package/spacejam)
45+
```bash
46+
$ spacejam-mocha ./
47+
```

‎meteor-koa-tests.js‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1-
// Import Tinytest from the tinytest Meteor package.
2-
import{Tinytest}from"meteor/tinytest";
1+
import{WebApp}from'meteor/webapp';
32

4-
// Import and rename a variable exported by meteor-koa.js.
5-
import{nameaspackageName}from"meteor/meteor-koa";
3+
import{assert}from'meteor/practicalmeteor:chai';
64

7-
// Write your tests here!
8-
// Here is an example.
9-
Tinytest.add('meteor-koa - example',function(test){
10-
test.equal(packageName,"meteor-koa");
5+
import{koa}from'meteor/meteor-koa';
6+
import{createRequest}from'meteor/meteor-koa-testing';
7+
8+
constapp=koa();
9+
10+
app.use((ctx)=>{
11+
ctx.body='Hello World';
12+
});
13+
14+
constrequest=createRequest(app.listen());
15+
16+
describe('meteor koa - Hello World',function(){
17+
it('should say "Hello World"',function(done){
18+
request
19+
.get('/')
20+
.expect(200)
21+
.expect('Hello World',done);
22+
});
1123
});

‎meteor-koa.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { WebApp } from 'meteor/webapp';
55

66
exportconstkoa=function(){
77
constapp=newKoa();
8-
WebApp.connectHandlers.use(Meteor.bindEnvironment(app.callback()));
8+
if(!Meteor.isPackageTest){
9+
WebApp.connectHandlers.use(Meteor.bindEnvironment(app.callback()));
10+
}
911
returnapp;
1012
};

‎package.js‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package.describe({
22
name:'meteor-koa',
3-
version:'0.0.1',
3+
version:'0.1.0',
44
// Brief, one-line summary of the package.
5-
summary:'Koa next generation web frameworkfor Meteor',
5+
summary:'Koa next generation web frameworkwith Meteor',
66
// URL to the Git repository containing the source code for this package.
77
git:'https://github.com/ssr-server/meteor-koa',
88
// By default, Meteor will default to using README.md for documentation.
@@ -26,7 +26,14 @@ Package.onUse(function(api) {
2626

2727
Package.onTest(function(api){
2828
api.use('ecmascript');
29-
api.use('tinytest');
29+
30+
api.use('webapp','server');
31+
32+
api.use('practicalmeteor:mocha');
33+
api.use('practicalmeteor:chai');
34+
3035
api.use('meteor-koa');
31-
api.mainModule('meteor-koa-tests.js');
36+
api.use('meteor-koa-testing');
37+
38+
api.mainModule('meteor-koa-tests.js','server');
3239
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp