Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ptariche/ecma7-koa2-starter
An ECMA7 Koa2 starter
https://github.com/ptariche/ecma7-koa2-starter
couchbase ecma7 ecmascript2015 koa2 starter
Last synced: about 1 month ago
JSON representation
An ECMA7 Koa2 starter
- Host: GitHub
- URL: https://github.com/ptariche/ecma7-koa2-starter
- Owner: ptariche
- Archived: true
- Created: 2016-05-02T02:07:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T14:59:15.000Z (about 4 years ago)
- Last Synced: 2024-09-26T16:41:12.732Z (about 2 months ago)
- Topics: couchbase, ecma7, ecmascript2015, koa2, starter
- Language: JavaScript
- Homepage:
- Size: 17.6 KB
- Stars: 22
- Watchers: 5
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ECMA7 Koa2 Starter
### PREREQUISITES
- Couchbase
- Node 4.3.1 or greater than### Routes
- /user/create - [POST]
- Expected input JSON Data```js
{
"email":"[email protected]",
"firstName":"tester",
"lastName":"super"
}
```
- Expected Response```js
{
"code": 200,
"data": {
"user": {
"created": true
}
}
}
```### Environment Variables
```js
process.env.SECRET
process.env.SALT
process.env.PORT
process.env.COUCHBASE_URI
process.env.COUCHBASE_BUCKET
process.env.PASSWORD
```### To Run
```js
npm install && gulp && npm start
```#### Function to Chain a Class with Await/async
```js
helpers.chain = async (_functions) => {
let _this = null;
let result = null;
for (let i = 0; i < _functions.length; i++) {
let _function = _functions[i];
result = _this ? await _this[_function]() : await _function();
_this = result;
};return result;
};
```#### Example of Chain Function
```jsconst CHAIN = require('./../../helpers/index').chain;
let UserController = require('./../../controllers/user');module.exports.post = async (ctx, next) => { return ctx.body = await CHAIN([() => { return new UserController(ctx, next); }, 'logic', 'response']); };
```#### Authors
Peter A.Tariche