Skip to content

Commit 3639179

Browse files
authored
Initial commit
0 parents  commit 3639179

File tree

16 files changed

+374
-0
lines changed

16 files changed

+374
-0
lines changed

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
extends: 'digitalbazaar'
7+
};

.github/workflows/main.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Bedrock Node.js CI
2+
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
strategy:
10+
matrix:
11+
node-version: [14.x]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Use Node.js ${{ matrix.node-version }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- run: npm install
19+
- name: Run eslint
20+
run: npm run lint
21+
test-node:
22+
needs: [lint]
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
services:
26+
mongodb:
27+
image: mongo:4.2
28+
ports:
29+
- 27017:27017
30+
strategy:
31+
matrix:
32+
node-version: [12.x, 14.x]
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Use Node.js ${{ matrix.node-version }}
36+
uses: actions/setup-node@v1
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
- run: |
40+
cd test
41+
npm install
42+
- name: Run test with Node.js ${{ matrix.node-version }}
43+
run: |
44+
cd test
45+
npm test
46+
coverage:
47+
needs: [test-node]
48+
runs-on: ubuntu-latest
49+
timeout-minutes: 10
50+
services:
51+
mongodb:
52+
image: mongo:4.2
53+
ports:
54+
- 27017:27017
55+
strategy:
56+
matrix:
57+
node-version: [14.x]
58+
steps:
59+
- uses: actions/checkout@v2
60+
- name: Use Node.js ${{ matrix.node-version }}
61+
uses: actions/setup-node@v1
62+
with:
63+
node-version: ${{ matrix.node-version }}
64+
- run: |
65+
cd test
66+
npm install
67+
- name: Generate coverage report
68+
run: |
69+
cd test
70+
npm run coverage-ci
71+
- name: Upload coverage to Codecov
72+
uses: codecov/codecov-action@v1
73+
with:
74+
file: ./test/coverage/lcov.info
75+
fail_ci_if_error: true

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.log
2+
*.sw[nop]
3+
*~
4+
.nyc_output
5+
.project
6+
.settings
7+
.vscode
8+
TAGS
9+
coverage
10+
node_modules
11+
reports

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# bedrock-module-template-http ChangeLog
2+
3+
## 1.0.0 - TBD
4+
5+
- See git history for changes.

LICENSE.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
Bedrock Non-Commercial License v1.0
2+
===================================
3+
4+
Copyright (c) 2011-2021 Digital Bazaar, Inc.
5+
All rights reserved.
6+
7+
Summary
8+
=======
9+
10+
This license allows the licensee to use Bedrock and its software modules
11+
for non-commercial purposes such as self-study, research, personal
12+
projects, or for evaluation purposes. If the licensee uses Bedrock
13+
directly or indirectly to generate revenue, or to provide products or
14+
services to more than 500 people (users), the licensee must immediately
15+
obtain a non-profit or commercial license.
16+
17+
Examples
18+
========
19+
20+
These are examples of cases that are allowed by this license:
21+
22+
* The licensee is an individual that creates Bedrock-dependent software for
23+
personal use only.
24+
* The licensee is an individual or group of students/researchers that uses
25+
Bedrock to experiment with an idea for a non-commercial project.
26+
* The licensee is a startup company that prototypes a Bedrock-dependent
27+
product before they have cash flow and will be testing the prototype
28+
software with less than 500 users. The service will not generate revenue
29+
of any kind.
30+
* The licensee is a for-profit organization that creates a product or
31+
service that is used by less than 500 users and is built with or
32+
integrates with Bedrock. The service must be exclusively provided for free
33+
and no parent, subsidiary, agent, or affiliate organization may profit
34+
from its use.
35+
36+
These cases require a non-profit or commercial license:
37+
38+
* The licensee is a non-profit that receives funding to create and/or run a
39+
Bedrock-dependent service.
40+
* The licensee is a startup company with Bedrock-dependent software that is
41+
funded by another organization.
42+
* The licensee is a startup company that is going into production with
43+
Bedrock-dependent software.
44+
* The licensee has more than 500 users using a Bedrock-dependent service
45+
either directly or indirectly.
46+
* The licensee is a medium to large organization that builds or integrates a
47+
commercial product or service with Bedrock.
48+
49+
THE LICENSE
50+
===========
51+
52+
This section and all subsequent sections of this document constitute the
53+
agreement between the licensee and Digital Bazaar, Inc.
54+
55+
DEFINITIONS
56+
===========
57+
58+
* Product - The Bedrock software and any modules associated with Bedrock
59+
where Digital Bazaar, Inc. owns the copyright.
60+
61+
CONDITIONS
62+
==========
63+
64+
Redistribution and use in source and binary forms, with or without
65+
modification, are permitted for NON-COMMERCIAL PURPOSES as long as the
66+
following conditions are met:
67+
68+
1. Any use of the Product must not generate revenue for the licensee or
69+
any parent, subsidiary, agent, or affiliate of the licensee. Use of
70+
Product includes, but is not limited to, interacting with any of the
71+
licensee's Product-dependent products or services over a network.
72+
73+
2. The aggregate number of individual people (users) of the licensee's
74+
products or services that use Product must be less than 500.
75+
76+
3. Redistributions of source code must retain the above copyright notice
77+
intact, this list of conditions and the following disclaimer.
78+
79+
4. Redistributions in binary form must reproduce the above copyright
80+
notice, this license and the following disclaimer in the documentation and
81+
on a web page available via interactive use and/or other materials
82+
provided with the distribution.
83+
84+
5. Neither the name of the copyright holder, the names of its
85+
contributors, nor any trademarks held by the copyright holder may be used
86+
to endorse or promote products or services built using the Product without
87+
specific prior written permission.
88+
89+
6. Any modifications are clearly outlined in release documentation and are
90+
specifically mentioned as not being a part of an official Product release.
91+
No additional restrictions to this license may be made when distributing
92+
modifications.
93+
94+
7. For the avoidance of doubt, this license prohibits sublicensing of the
95+
Product.
96+
97+
8. Any breach of this license by licensee must be resolved within 30 days.
98+
Failure to do so results in the termination of this license.
99+
100+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
101+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
102+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
103+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
104+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
105+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
106+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
107+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
108+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
109+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
110+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
111+
112+
To obtain a non-profit or commercial license for Product, please contact
113+
Digital Bazaar, Inc. at the following email address:
114+
115+
Digital Bazaar <[email protected]>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# bedrock-module-template-http

lib/config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*!
2+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
3+
*/
4+
import bedrock from 'bedrock';
5+
const {config} = bedrock;
6+
7+
const namespace = 'module-template-http';
8+
const cfg = config[namespace] = {};
9+
10+
const basePath = '/foo';
11+
cfg.routes = {
12+
basePath
13+
};

lib/http.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*!
2+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
3+
*/
4+
import {asyncHandler} from 'bedrock-express';
5+
import bedrock from 'bedrock';
6+
const {config} = bedrock;
7+
8+
bedrock.events.on('bedrock-express.configure.routes', app => {
9+
const {routes} = config['module-template-http'];
10+
app.post(
11+
routes.basePath,
12+
asyncHandler(async (/*req, res*/) => {
13+
}));
14+
});

lib/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*!
2+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
3+
*/
4+
'use strict';
5+
6+
// translate `main.js` to CommonJS
7+
require = require('esm')(module);
8+
module.exports = require('./main.js');

lib/main.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*!
2+
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
3+
*/
4+
import 'bedrock-express';
5+
6+
import './config.js';
7+
import './http.js';

0 commit comments

Comments
 (0)