-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from radoslavirha/microservices
Microservices
- Loading branch information
Showing
132 changed files
with
3,587 additions
and
852 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
*/coverage | ||
*/dist | ||
*/node_modules | ||
*/.DS_Store | ||
*/**/config.json | ||
.act | ||
.git | ||
.github | ||
.husky | ||
.vscode | ||
docker | ||
!docker/nginx | ||
docs | ||
node_modules | ||
.gitignore | ||
.DS_Store | ||
.release-please-manifest.json | ||
CHANGELOG*.md | ||
release-please-config.json | ||
|
||
*/config/*.json | ||
coverage | ||
dist | ||
*/.eslintrc.js | ||
*/jest.config.json | ||
|
||
packages/config/config/*.json | ||
!packages/config/config/*.template.json |
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
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,4 +1,5 @@ | ||
**/coverage | ||
**/dist | ||
**/node_modules | ||
*/.DS_Store | ||
*/.DS_Store | ||
api/**/config/*.json |
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,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
pnpm run lint |
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,13 @@ | ||
{ | ||
"directory": [ | ||
"./src/docs/controllers/pages", | ||
"./src/v1/controllers" | ||
], | ||
"exclude": [ | ||
"__mock__", | ||
"__mocks__", | ||
".spec.ts" | ||
], | ||
"delete": true, | ||
"singleQuotes": true | ||
} |
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,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@hikers-book/eslint-config'] | ||
}; |
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,36 @@ | ||
# Hiker's Book Authentication API | ||
|
||
## Getting started | ||
|
||
```sh | ||
# install dependencies | ||
pnpm install | ||
|
||
# serve | ||
pnpm start | ||
|
||
# build for production | ||
pnpm build | ||
pnpm start:prod | ||
``` | ||
|
||
## Barrelsby | ||
|
||
This project uses [barrelsby](https://www.npmjs.com/package/barrelsby) to generate index files to import the controllers. | ||
|
||
Edit `.barreslby.json` to customize it: | ||
|
||
```json | ||
{ | ||
"directory": [ | ||
"./src/controllers/rest", | ||
"./src/controllers/pages" | ||
], | ||
"exclude": [ | ||
"__mock__", | ||
"__mocks__", | ||
".spec.ts" | ||
], | ||
"delete": true | ||
} | ||
``` |
File renamed without changes.
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,21 @@ | ||
module.exports = { | ||
clearMocks: true, | ||
collectCoverage: true, | ||
coverageDirectory: 'coverage', | ||
coveragePathIgnorePatterns: ['index.ts', '/node_modules/'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 70, | ||
functions: 70, | ||
lines: 70, | ||
statements: 70 | ||
} | ||
}, | ||
globalTeardown: './scripts/jest/teardown.js', | ||
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'], | ||
testEnvironment: 'node', | ||
testMatch: ['**/src/**/__tests__/**/*.[jt]s?(x)', '**/src/**/?(*.)+(spec|test).[tj]s?(x)'], | ||
transform: { | ||
'\\.(ts)$': 'ts-jest' | ||
} | ||
}; |
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,105 @@ | ||
{ | ||
"name": "@hikers-book/authentication-api", | ||
"version": "0.4.0", | ||
"description": "Hiker's Book Authentication API", | ||
"author": "radoslav.irha@gmail.com", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "pnpm run barrels && tsc --project tsconfig.compile.json", | ||
"barrels": "barrelsby --config .barrelsby.json", | ||
"start": "pnpm run barrels && tsnd --inspect --exit-child --cls --ignore-watch node_modules --respawn --transpile-only -r tsconfig-paths/register src/index.ts", | ||
"start:prod": "cross-env NODE_ENV=production node dist/index.js", | ||
"format": "eslint --ext .ts --fix src", | ||
"lint": "eslint --ext .ts src", | ||
"test": "pnpm run test:coverage", | ||
"test:unit": "cross-env NODE_ENV=test jest", | ||
"test:coverage": "pnpm run test:unit", | ||
"config": "hikers-book-config-cli -s node_modules/@hikers-book/config/config/api.authentication.json -t config/default.json -f json || true", | ||
"config:test": "hikers-book-config-cli -s node_modules/@hikers-book/config/config/api.authentication.json -t config/test.json -f json || true", | ||
"config:env": "hikers-book-config-cli -s node_modules/@hikers-book/config/environment-variables/api.authentication.json -t config/custom-environment-variables.json -f json || true", | ||
"config:clear": "find ./config -name '*.json' -type f -delete", | ||
"config:all": "pnpm run config:env && pnpm run config && pnpm run config:test", | ||
"postinstall": "pnpm run config:all" | ||
}, | ||
"dependencies": { | ||
"@hikers-book/tsed-swagger": "workspace:*", | ||
"@tsed/ajv": "^7.36.8", | ||
"@tsed/common": "^7.36.8", | ||
"@tsed/core": "^7.36.8", | ||
"@tsed/di": "^7.36.8", | ||
"@tsed/engines": "^7.36.8", | ||
"@tsed/exceptions": "^7.36.8", | ||
"@tsed/json-mapper": "^7.36.8", | ||
"@tsed/logger": "^6.6.3", | ||
"@tsed/logger-file": "^6.6.3", | ||
"@tsed/mongoose": "^7.36.8", | ||
"@tsed/platform-cache": "^7.36.8", | ||
"@tsed/platform-exceptions": "^7.36.8", | ||
"@tsed/platform-express": "^7.36.8", | ||
"@tsed/platform-log-middleware": "^7.36.8", | ||
"@tsed/platform-middlewares": "^7.36.8", | ||
"@tsed/platform-params": "^7.36.8", | ||
"@tsed/platform-response-filter": "^7.36.8", | ||
"@tsed/platform-views": "^7.36.8", | ||
"@tsed/schema": "^7.36.8", | ||
"@tsed/swagger": "^7.36.8", | ||
"ajv": "^8.12.0", | ||
"barrelsby": "^2.8.1", | ||
"body-parser": "^1.20.2", | ||
"class-validator": "^0.13.2", | ||
"compression": "^1.7.4", | ||
"config": "^3.3.9", | ||
"cookie-parser": "^1.4.6", | ||
"cors": "^2.8.5", | ||
"cross-env": "^7.0.3", | ||
"dotenv": "^16.3.1", | ||
"dotenv-expand": "^10.0.0", | ||
"dotenv-flow": "^3.3.0", | ||
"express": "^4.18.2", | ||
"helmet": "^7.0.0", | ||
"method-override": "^3.0.0", | ||
"mongoose": "^7.5.0" | ||
}, | ||
"devDependencies": { | ||
"@hikers-book/cli-tools": "workspace:*", | ||
"@hikers-book/config": "workspace:*", | ||
"@hikers-book/eslint-config": "workspace:*", | ||
"@tsed/cli-plugin-eslint": "4.6.4", | ||
"@tsed/cli-plugin-jest": "4.6.4", | ||
"@tsed/cli-plugin-mongoose": "4.6.4", | ||
"@tsed/testing-mongoose": "^7.36.8", | ||
"@types/body-parser": "^1.19.3", | ||
"@types/compression": "^1.7.3", | ||
"@types/config": "^3.3.1", | ||
"@types/cookie-parser": "^1.4.4", | ||
"@types/cors": "^2.8.14", | ||
"@types/express": "^4.17.18", | ||
"@types/jest": "^29.5.5", | ||
"@types/method-override": "^0.0.33", | ||
"@types/multer": "^1.4.8", | ||
"@types/node": "^20.5.7", | ||
"@types/supertest": "^2.0.14", | ||
"@types/validator": "^13.11.2", | ||
"jest": "^29.7.0", | ||
"supertest": "^6.3.3", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"ts-node-dev": "^2.0.0", | ||
"tsconfig-paths": "^4.2.0", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.2.2" | ||
}, | ||
"tsed": { | ||
"convention": "conv_default", | ||
"architecture": "arc_default", | ||
"packageManager": "pnpm" | ||
}, | ||
"engines": { | ||
"node": ">= 18.0.0", | ||
"pnpm": ">= 8.7.0" | ||
}, | ||
"os": [ | ||
"darwin", | ||
"linux" | ||
] | ||
} |
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,3 @@ | ||
module.exports = async () => { | ||
(await global.__MONGOD__) && global.__MONGOD__.stop(); | ||
}; |
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,26 @@ | ||
import { PlatformTest } from '@tsed/common'; | ||
import { TestMongooseContext } from '@tsed/testing-mongoose'; | ||
import SuperTest from 'supertest'; | ||
import { Server } from './Server'; | ||
|
||
describe('Server', () => { | ||
let request: SuperTest.SuperTest<SuperTest.Test>; | ||
|
||
beforeEach(TestMongooseContext.bootstrap(Server)); | ||
beforeEach(() => { | ||
request = SuperTest(PlatformTest.callback()); | ||
}); | ||
|
||
afterEach(TestMongooseContext.reset); | ||
|
||
it('should call GET /rest', async () => { | ||
const response = await request.get('/rest').expect(404); | ||
|
||
expect(response.body).toEqual({ | ||
errors: [], | ||
message: 'Resource "/rest" not found', | ||
name: 'NOT_FOUND', | ||
status: 404 | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.