generated from cheqd/.github
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Run NPM format and fix release config (#246)
* Add prettier config * Update dependabot.yml * npm update * Release config * npm run format
- Loading branch information
Showing
19 changed files
with
1,058 additions
and
1,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock | ||
*.md | ||
*.yaml | ||
*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"useTabs": true, | ||
"tabWidth": 4, | ||
"printWidth": 120, | ||
"proseWrap": "always", | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,69 @@ | ||
import express from 'express' | ||
import Helmet from 'helmet' | ||
import * as swagger from 'swagger-ui-express' | ||
import * as swaggerJson from '../swagger.json' | ||
import express from 'express'; | ||
import Helmet from 'helmet'; | ||
import * as swagger from 'swagger-ui-express'; | ||
import * as swaggerJson from '../swagger.json'; | ||
|
||
import { DidController } from './controllers/did' | ||
import { CheqdController } from './controllers/cheqd' | ||
import { ResourceController } from './controllers/resource' | ||
import { CheqdRegistrar } from './service/cheqd' | ||
import { DidController } from './controllers/did'; | ||
import { CheqdController } from './controllers/cheqd'; | ||
import { ResourceController } from './controllers/resource'; | ||
import { CheqdRegistrar } from './service/cheqd'; | ||
|
||
class App { | ||
public express: express.Application | ||
|
||
constructor() { | ||
this.express = express() | ||
this.middleware() | ||
this.routes() | ||
CheqdRegistrar.instance | ||
} | ||
|
||
private middleware() { | ||
this.express.use(express.json({ limit: '50mb' })) | ||
this.express.use(express.urlencoded({ extended: false })) | ||
this.express.use(Helmet()) | ||
this.express.use('/api-docs', swagger.serve, swagger.setup(swaggerJson)) | ||
} | ||
|
||
private routes() { | ||
const app = this.express | ||
const URL_PREFIX = '/1.0' | ||
|
||
app.get('/', (req, res) => res.redirect('api-docs')) | ||
|
||
// did-registrar | ||
app.post(`${URL_PREFIX}/create`, DidController.createValidator, DidController.commonValidator, new DidController().create) | ||
app.post(`${URL_PREFIX}/update`, DidController.updateValidator, DidController.commonValidator, new DidController().update) | ||
app.post(`${URL_PREFIX}/deactivate`, DidController.deactivateValidator, DidController.commonValidator, new DidController().deactivate) | ||
app.post(`${URL_PREFIX}/:did/create-resource`, ResourceController.createValidator, DidController.commonValidator, new ResourceController().create) | ||
|
||
// cheqd-helpers | ||
app.get(`${URL_PREFIX}/key-pair`, new CheqdController().generateKeys) | ||
app.get(`${URL_PREFIX}/did-document`, CheqdController.didDocValidator, new CheqdController().generateDidDoc) | ||
|
||
// 404 for all other requests | ||
app.all('*', (req, res) => res.status(400).send('Bad request')) | ||
} | ||
|
||
public express: express.Application; | ||
|
||
constructor() { | ||
this.express = express(); | ||
this.middleware(); | ||
this.routes(); | ||
CheqdRegistrar.instance; | ||
} | ||
|
||
private middleware() { | ||
this.express.use(express.json({ limit: '50mb' })); | ||
this.express.use(express.urlencoded({ extended: false })); | ||
this.express.use(Helmet()); | ||
this.express.use('/api-docs', swagger.serve, swagger.setup(swaggerJson)); | ||
} | ||
|
||
private routes() { | ||
const app = this.express; | ||
const URL_PREFIX = '/1.0'; | ||
|
||
app.get('/', (req, res) => res.redirect('api-docs')); | ||
|
||
// did-registrar | ||
app.post( | ||
`${URL_PREFIX}/create`, | ||
DidController.createValidator, | ||
DidController.commonValidator, | ||
new DidController().create | ||
); | ||
app.post( | ||
`${URL_PREFIX}/update`, | ||
DidController.updateValidator, | ||
DidController.commonValidator, | ||
new DidController().update | ||
); | ||
app.post( | ||
`${URL_PREFIX}/deactivate`, | ||
DidController.deactivateValidator, | ||
DidController.commonValidator, | ||
new DidController().deactivate | ||
); | ||
app.post( | ||
`${URL_PREFIX}/:did/create-resource`, | ||
ResourceController.createValidator, | ||
DidController.commonValidator, | ||
new ResourceController().create | ||
); | ||
|
||
// cheqd-helpers | ||
app.get(`${URL_PREFIX}/key-pair`, new CheqdController().generateKeys); | ||
app.get(`${URL_PREFIX}/did-document`, CheqdController.didDocValidator, new CheqdController().generateDidDoc); | ||
|
||
// 404 for all other requests | ||
app.all('*', (req, res) => res.status(400).send('Bad request')); | ||
} | ||
} | ||
|
||
export default new App().express | ||
export default new App().express; |
Oops, something went wrong.