File tree Expand file tree Collapse file tree 12 files changed +81
-43
lines changed
Expand file tree Collapse file tree 12 files changed +81
-43
lines changed Original file line number Diff line number Diff line change 1+ module . exports = {
2+ root : true ,
3+ env : {
4+ node : true
5+ } ,
6+ extends : [
7+ 'digitalbazaar' ,
8+ 'digitalbazaar/jsdoc' ,
9+ 'digitalbazaar/module'
10+ ] ,
11+ ignorePatterns : [ 'node_modules/' ] ,
12+ rules : {
13+ 'unicorn/prefer-node-protocol' : 'error'
14+ }
15+ } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11* .log
22* .sw [nop ]
33* ~
4- .nyc_output
54.project
65.settings
76.vscode
87TAGS
98coverage
109node_modules
1110reports
11+ package-lock.json
Original file line number Diff line number Diff line change 1+ legacy-peer-deps = true
Original file line number Diff line number Diff line change 2525
2626## Install
2727
28- - Node.js 12 + is required.
28+ - Node.js 20 + is required.
2929
3030### NPM
3131
3232To install via NPM:
3333
3434```
35- npm install --save bedrock- module-template-http
35+ npm install --save @ bedrock/ module-template-http
3636```
3737
3838### Development
Original file line number Diff line number Diff line change 11/*!
2- * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
2+ * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.
33 */
4- import bedrock from 'bedrock' ;
4+ import * as bedrock from '@ bedrock/core ' ;
55const { config} = bedrock ;
66
7- const namespace = 'module-template-http' ;
7+ export const namespace = 'module-template-http' ;
88const cfg = config [ namespace ] = { } ;
99
10- const basePath = '/foo' ;
1110cfg . routes = {
12- basePath
11+ basePath : '/foo'
1312} ;
Original file line number Diff line number Diff line change 11/*!
2- * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
2+ * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.
33 */
4- import { asyncHandler } from 'bedrock-express' ;
5- import bedrock from 'bedrock' ;
6- const { config} = bedrock ;
4+ import * as bedrock from '@bedrock/core' ;
5+ import { asyncHandler } from '@bedrock/express' ;
6+ import { createValidateMiddleware as validate } from '@bedrock/validation' ;
7+ import { example } from '../schemas/bedrock-template.js'
8+
9+ const { util : { BedrockError} } = bedrock ;
710
811bedrock . events . on ( 'bedrock-express.configure.routes' , app => {
9- const { routes} = config [ 'module-template-http' ] ;
12+ const { config} = bedrock ;
13+ const { routes} = config [ namespace ] ;
14+
1015 app . post (
1116 routes . basePath ,
17+ validate ( { bodySchema : example } ) ,
1218 asyncHandler ( async ( /*req, res*/ ) => {
13- } ) ) ;
19+ throw new BedrockError (
20+ 'Not implemented.' , {
21+ name : 'NotFoundError' ,
22+ details : { httpStatusCode : 501 , public : true }
23+ } ) ;
24+ } )
25+ ) ;
1426} ) ;
Original file line number Diff line number Diff line change 11/*!
2- * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
2+ * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.
33 */
4- 'use strict ';
4+ import '@bedrock/express ';
55
6- // translate `main.js` to CommonJS
7- require = require ( 'esm' ) ( module ) ;
8- module . exports = require ( './main.js' ) ;
6+ import './config.js' ;
7+ import './http.js' ;
Original file line number Diff line number Diff line change 1+ /*!
2+ * Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved.
3+ */
4+ import { loggers } from '@bedrock/core' ;
5+ import { namespace } from './config.js' ;
6+
7+ export const logger = loggers . get ( 'app' ) . child ( namespace ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments