Roger Surf
commited on
Commit
·
b7e75fd
1
Parent(s):
f15d7db
feat: add NestJS API with Handlebars - basic dashboard working
Browse files- api/.gitignore +56 -0
- api/.prettierrc +4 -0
- api/README.md +98 -0
- api/eslint.config.mjs +35 -0
- api/nest-cli.json +8 -0
- api/package-lock.json +0 -0
- api/package.json +73 -0
- api/public/css/style.css +43 -0
- api/src/app.controller.spec.ts +22 -0
- api/src/app.controller.ts +12 -0
- api/src/app.module.ts +10 -0
- api/src/app.service.ts +8 -0
- api/src/main.ts +19 -0
- api/test/app.e2e-spec.ts +25 -0
- api/test/jest-e2e.json +9 -0
- api/tsconfig.build.json +4 -0
- api/tsconfig.json +25 -0
- api/views/dashboard.hbs +18 -0
- requirements.txt +1 -1
api/.gitignore
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# compiled output
|
| 2 |
+
/dist
|
| 3 |
+
/node_modules
|
| 4 |
+
/build
|
| 5 |
+
|
| 6 |
+
# Logs
|
| 7 |
+
logs
|
| 8 |
+
*.log
|
| 9 |
+
npm-debug.log*
|
| 10 |
+
pnpm-debug.log*
|
| 11 |
+
yarn-debug.log*
|
| 12 |
+
yarn-error.log*
|
| 13 |
+
lerna-debug.log*
|
| 14 |
+
|
| 15 |
+
# OS
|
| 16 |
+
.DS_Store
|
| 17 |
+
|
| 18 |
+
# Tests
|
| 19 |
+
/coverage
|
| 20 |
+
/.nyc_output
|
| 21 |
+
|
| 22 |
+
# IDEs and editors
|
| 23 |
+
/.idea
|
| 24 |
+
.project
|
| 25 |
+
.classpath
|
| 26 |
+
.c9/
|
| 27 |
+
*.launch
|
| 28 |
+
.settings/
|
| 29 |
+
*.sublime-workspace
|
| 30 |
+
|
| 31 |
+
# IDE - VSCode
|
| 32 |
+
.vscode/*
|
| 33 |
+
!.vscode/settings.json
|
| 34 |
+
!.vscode/tasks.json
|
| 35 |
+
!.vscode/launch.json
|
| 36 |
+
!.vscode/extensions.json
|
| 37 |
+
|
| 38 |
+
# dotenv environment variable files
|
| 39 |
+
.env
|
| 40 |
+
.env.development.local
|
| 41 |
+
.env.test.local
|
| 42 |
+
.env.production.local
|
| 43 |
+
.env.local
|
| 44 |
+
|
| 45 |
+
# temp directory
|
| 46 |
+
.temp
|
| 47 |
+
.tmp
|
| 48 |
+
|
| 49 |
+
# Runtime data
|
| 50 |
+
pids
|
| 51 |
+
*.pid
|
| 52 |
+
*.seed
|
| 53 |
+
*.pid.lock
|
| 54 |
+
|
| 55 |
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
| 56 |
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
api/.prettierrc
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"singleQuote": true,
|
| 3 |
+
"trailingComma": "all"
|
| 4 |
+
}
|
api/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<p align="center">
|
| 2 |
+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
| 3 |
+
</p>
|
| 4 |
+
|
| 5 |
+
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
| 6 |
+
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
| 7 |
+
|
| 8 |
+
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
| 9 |
+
<p align="center">
|
| 10 |
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
| 11 |
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
| 12 |
+
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
| 13 |
+
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
| 14 |
+
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
| 15 |
+
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
| 16 |
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
| 17 |
+
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
| 18 |
+
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
| 19 |
+
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
| 20 |
+
</p>
|
| 21 |
+
<!--[](https://opencollective.com/nest#backer)
|
| 22 |
+
[](https://opencollective.com/nest#sponsor)-->
|
| 23 |
+
|
| 24 |
+
## Description
|
| 25 |
+
|
| 26 |
+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
| 27 |
+
|
| 28 |
+
## Project setup
|
| 29 |
+
|
| 30 |
+
```bash
|
| 31 |
+
$ npm install
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Compile and run the project
|
| 35 |
+
|
| 36 |
+
```bash
|
| 37 |
+
# development
|
| 38 |
+
$ npm run start
|
| 39 |
+
|
| 40 |
+
# watch mode
|
| 41 |
+
$ npm run start:dev
|
| 42 |
+
|
| 43 |
+
# production mode
|
| 44 |
+
$ npm run start:prod
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Run tests
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
# unit tests
|
| 51 |
+
$ npm run test
|
| 52 |
+
|
| 53 |
+
# e2e tests
|
| 54 |
+
$ npm run test:e2e
|
| 55 |
+
|
| 56 |
+
# test coverage
|
| 57 |
+
$ npm run test:cov
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Deployment
|
| 61 |
+
|
| 62 |
+
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
| 63 |
+
|
| 64 |
+
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
$ npm install -g @nestjs/mau
|
| 68 |
+
$ mau deploy
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
| 72 |
+
|
| 73 |
+
## Resources
|
| 74 |
+
|
| 75 |
+
Check out a few resources that may come in handy when working with NestJS:
|
| 76 |
+
|
| 77 |
+
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
| 78 |
+
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
| 79 |
+
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
| 80 |
+
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
| 81 |
+
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
| 82 |
+
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
| 83 |
+
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
| 84 |
+
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
| 85 |
+
|
| 86 |
+
## Support
|
| 87 |
+
|
| 88 |
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
| 89 |
+
|
| 90 |
+
## Stay in touch
|
| 91 |
+
|
| 92 |
+
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
| 93 |
+
- Website - [https://nestjs.com](https://nestjs.com/)
|
| 94 |
+
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
| 95 |
+
|
| 96 |
+
## License
|
| 97 |
+
|
| 98 |
+
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
api/eslint.config.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// @ts-check
|
| 2 |
+
import eslint from '@eslint/js';
|
| 3 |
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
| 4 |
+
import globals from 'globals';
|
| 5 |
+
import tseslint from 'typescript-eslint';
|
| 6 |
+
|
| 7 |
+
export default tseslint.config(
|
| 8 |
+
{
|
| 9 |
+
ignores: ['eslint.config.mjs'],
|
| 10 |
+
},
|
| 11 |
+
eslint.configs.recommended,
|
| 12 |
+
...tseslint.configs.recommendedTypeChecked,
|
| 13 |
+
eslintPluginPrettierRecommended,
|
| 14 |
+
{
|
| 15 |
+
languageOptions: {
|
| 16 |
+
globals: {
|
| 17 |
+
...globals.node,
|
| 18 |
+
...globals.jest,
|
| 19 |
+
},
|
| 20 |
+
sourceType: 'commonjs',
|
| 21 |
+
parserOptions: {
|
| 22 |
+
projectService: true,
|
| 23 |
+
tsconfigRootDir: import.meta.dirname,
|
| 24 |
+
},
|
| 25 |
+
},
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
rules: {
|
| 29 |
+
'@typescript-eslint/no-explicit-any': 'off',
|
| 30 |
+
'@typescript-eslint/no-floating-promises': 'warn',
|
| 31 |
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
| 32 |
+
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
| 33 |
+
},
|
| 34 |
+
},
|
| 35 |
+
);
|
api/nest-cli.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"$schema": "https://json.schemastore.org/nest-cli",
|
| 3 |
+
"collection": "@nestjs/schematics",
|
| 4 |
+
"sourceRoot": "src",
|
| 5 |
+
"compilerOptions": {
|
| 6 |
+
"deleteOutDir": true
|
| 7 |
+
}
|
| 8 |
+
}
|
api/package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
api/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "api",
|
| 3 |
+
"version": "0.0.1",
|
| 4 |
+
"description": "",
|
| 5 |
+
"author": "",
|
| 6 |
+
"private": true,
|
| 7 |
+
"license": "UNLICENSED",
|
| 8 |
+
"scripts": {
|
| 9 |
+
"build": "nest build",
|
| 10 |
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
| 11 |
+
"start": "nest start",
|
| 12 |
+
"start:dev": "nest start --watch",
|
| 13 |
+
"start:debug": "nest start --debug --watch",
|
| 14 |
+
"start:prod": "node dist/main",
|
| 15 |
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
| 16 |
+
"test": "jest",
|
| 17 |
+
"test:watch": "jest --watch",
|
| 18 |
+
"test:cov": "jest --coverage",
|
| 19 |
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
| 20 |
+
"test:e2e": "jest --config ./test/jest-e2e.json"
|
| 21 |
+
},
|
| 22 |
+
"dependencies": {
|
| 23 |
+
"@nestjs/common": "^11.0.1",
|
| 24 |
+
"@nestjs/core": "^11.0.1",
|
| 25 |
+
"@nestjs/platform-express": "^11.0.1",
|
| 26 |
+
"hbs": "^4.2.0",
|
| 27 |
+
"mathjs": "^15.1.0",
|
| 28 |
+
"reflect-metadata": "^0.2.2",
|
| 29 |
+
"rxjs": "^7.8.1"
|
| 30 |
+
},
|
| 31 |
+
"devDependencies": {
|
| 32 |
+
"@eslint/eslintrc": "^3.2.0",
|
| 33 |
+
"@eslint/js": "^9.18.0",
|
| 34 |
+
"@nestjs/cli": "^11.0.0",
|
| 35 |
+
"@nestjs/schematics": "^11.0.0",
|
| 36 |
+
"@nestjs/testing": "^11.0.1",
|
| 37 |
+
"@types/express": "^5.0.0",
|
| 38 |
+
"@types/jest": "^30.0.0",
|
| 39 |
+
"@types/node": "^22.10.7",
|
| 40 |
+
"@types/supertest": "^6.0.2",
|
| 41 |
+
"eslint": "^9.18.0",
|
| 42 |
+
"eslint-config-prettier": "^10.0.1",
|
| 43 |
+
"eslint-plugin-prettier": "^5.2.2",
|
| 44 |
+
"globals": "^16.0.0",
|
| 45 |
+
"jest": "^30.0.0",
|
| 46 |
+
"prettier": "^3.4.2",
|
| 47 |
+
"source-map-support": "^0.5.21",
|
| 48 |
+
"supertest": "^7.0.0",
|
| 49 |
+
"ts-jest": "^29.2.5",
|
| 50 |
+
"ts-loader": "^9.5.2",
|
| 51 |
+
"ts-node": "^10.9.2",
|
| 52 |
+
"tsconfig-paths": "^4.2.0",
|
| 53 |
+
"typescript": "^5.7.3",
|
| 54 |
+
"typescript-eslint": "^8.20.0"
|
| 55 |
+
},
|
| 56 |
+
"jest": {
|
| 57 |
+
"moduleFileExtensions": [
|
| 58 |
+
"js",
|
| 59 |
+
"json",
|
| 60 |
+
"ts"
|
| 61 |
+
],
|
| 62 |
+
"rootDir": "src",
|
| 63 |
+
"testRegex": ".*\\.spec\\.ts$",
|
| 64 |
+
"transform": {
|
| 65 |
+
"^.+\\.(t|j)s$": "ts-jest"
|
| 66 |
+
},
|
| 67 |
+
"collectCoverageFrom": [
|
| 68 |
+
"**/*.(t|j)s"
|
| 69 |
+
],
|
| 70 |
+
"coverageDirectory": "../coverage",
|
| 71 |
+
"testEnvironment": "node"
|
| 72 |
+
}
|
| 73 |
+
}
|
api/public/css/style.css
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
* {
|
| 2 |
+
margin: 0;
|
| 3 |
+
padding: 0;
|
| 4 |
+
box-sizing: border-box;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
body {
|
| 8 |
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 9 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 10 |
+
min-height: 100vh;
|
| 11 |
+
display: flex;
|
| 12 |
+
align-items: center;
|
| 13 |
+
justify-content: center;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.container {
|
| 17 |
+
background: white;
|
| 18 |
+
padding: 3rem;
|
| 19 |
+
border-radius: 20px;
|
| 20 |
+
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
| 21 |
+
text-align: center;
|
| 22 |
+
max-width: 600px;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
h1 {
|
| 26 |
+
color: #333;
|
| 27 |
+
margin-bottom: 1rem;
|
| 28 |
+
font-size: 2rem;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
p {
|
| 32 |
+
color: #666;
|
| 33 |
+
font-size: 1.1rem;
|
| 34 |
+
margin: 0.5rem 0;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.status {
|
| 38 |
+
margin-top: 2rem;
|
| 39 |
+
padding: 1.5rem;
|
| 40 |
+
background: #f0f9ff;
|
| 41 |
+
border-radius: 10px;
|
| 42 |
+
border-left: 4px solid #667eea;
|
| 43 |
+
}
|
api/src/app.controller.spec.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Test, TestingModule } from '@nestjs/testing';
|
| 2 |
+
import { AppController } from './app.controller';
|
| 3 |
+
import { AppService } from './app.service';
|
| 4 |
+
|
| 5 |
+
describe('AppController', () => {
|
| 6 |
+
let appController: AppController;
|
| 7 |
+
|
| 8 |
+
beforeEach(async () => {
|
| 9 |
+
const app: TestingModule = await Test.createTestingModule({
|
| 10 |
+
controllers: [AppController],
|
| 11 |
+
providers: [AppService],
|
| 12 |
+
}).compile();
|
| 13 |
+
|
| 14 |
+
appController = app.get<AppController>(AppController);
|
| 15 |
+
});
|
| 16 |
+
|
| 17 |
+
describe('root', () => {
|
| 18 |
+
it('should return "Hello World!"', () => {
|
| 19 |
+
expect(appController.getHello()).toBe('Hello World!');
|
| 20 |
+
});
|
| 21 |
+
});
|
| 22 |
+
});
|
api/src/app.controller.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Controller, Get, Render } from '@nestjs/common';
|
| 2 |
+
|
| 3 |
+
@Controller()
|
| 4 |
+
export class AppController {
|
| 5 |
+
@Get()
|
| 6 |
+
@Render('dashboard')
|
| 7 |
+
getDashboard() {
|
| 8 |
+
return {
|
| 9 |
+
candidateName: 'Candidate #0 - Test'
|
| 10 |
+
};
|
| 11 |
+
}
|
| 12 |
+
}
|
api/src/app.module.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Module } from '@nestjs/common';
|
| 2 |
+
import { AppController } from './app.controller';
|
| 3 |
+
import { AppService } from './app.service';
|
| 4 |
+
|
| 5 |
+
@Module({
|
| 6 |
+
imports: [],
|
| 7 |
+
controllers: [AppController],
|
| 8 |
+
providers: [AppService],
|
| 9 |
+
})
|
| 10 |
+
export class AppModule {}
|
api/src/app.service.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Injectable } from '@nestjs/common';
|
| 2 |
+
|
| 3 |
+
@Injectable()
|
| 4 |
+
export class AppService {
|
| 5 |
+
getHello(): string {
|
| 6 |
+
return 'Hello World!';
|
| 7 |
+
}
|
| 8 |
+
}
|
api/src/main.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { NestFactory } from '@nestjs/core';
|
| 2 |
+
import { AppModule } from './app.module';
|
| 3 |
+
import { NestExpressApplication } from '@nestjs/platform-express';
|
| 4 |
+
import { join } from 'path';
|
| 5 |
+
|
| 6 |
+
async function bootstrap() {
|
| 7 |
+
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
| 8 |
+
|
| 9 |
+
// Configurar Handlebars
|
| 10 |
+
app.setBaseViewsDir(join(__dirname, '..', 'views'));
|
| 11 |
+
app.setViewEngine('hbs');
|
| 12 |
+
|
| 13 |
+
// Servir arquivos estáticos (CSS/JS)
|
| 14 |
+
app.useStaticAssets(join(__dirname, '..', 'public'));
|
| 15 |
+
|
| 16 |
+
await app.listen(3000);
|
| 17 |
+
console.log('🚀 Application running on: http://localhost:3000');
|
| 18 |
+
}
|
| 19 |
+
bootstrap();
|
api/test/app.e2e-spec.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Test, TestingModule } from '@nestjs/testing';
|
| 2 |
+
import { INestApplication } from '@nestjs/common';
|
| 3 |
+
import request from 'supertest';
|
| 4 |
+
import { App } from 'supertest/types';
|
| 5 |
+
import { AppModule } from './../src/app.module';
|
| 6 |
+
|
| 7 |
+
describe('AppController (e2e)', () => {
|
| 8 |
+
let app: INestApplication<App>;
|
| 9 |
+
|
| 10 |
+
beforeEach(async () => {
|
| 11 |
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
| 12 |
+
imports: [AppModule],
|
| 13 |
+
}).compile();
|
| 14 |
+
|
| 15 |
+
app = moduleFixture.createNestApplication();
|
| 16 |
+
await app.init();
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
it('/ (GET)', () => {
|
| 20 |
+
return request(app.getHttpServer())
|
| 21 |
+
.get('/')
|
| 22 |
+
.expect(200)
|
| 23 |
+
.expect('Hello World!');
|
| 24 |
+
});
|
| 25 |
+
});
|
api/test/jest-e2e.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"moduleFileExtensions": ["js", "json", "ts"],
|
| 3 |
+
"rootDir": ".",
|
| 4 |
+
"testEnvironment": "node",
|
| 5 |
+
"testRegex": ".e2e-spec.ts$",
|
| 6 |
+
"transform": {
|
| 7 |
+
"^.+\\.(t|j)s$": "ts-jest"
|
| 8 |
+
}
|
| 9 |
+
}
|
api/tsconfig.build.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"extends": "./tsconfig.json",
|
| 3 |
+
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
| 4 |
+
}
|
api/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"module": "nodenext",
|
| 4 |
+
"moduleResolution": "nodenext",
|
| 5 |
+
"resolvePackageJsonExports": true,
|
| 6 |
+
"esModuleInterop": true,
|
| 7 |
+
"isolatedModules": true,
|
| 8 |
+
"declaration": true,
|
| 9 |
+
"removeComments": true,
|
| 10 |
+
"emitDecoratorMetadata": true,
|
| 11 |
+
"experimentalDecorators": true,
|
| 12 |
+
"allowSyntheticDefaultImports": true,
|
| 13 |
+
"target": "ES2023",
|
| 14 |
+
"sourceMap": true,
|
| 15 |
+
"outDir": "./dist",
|
| 16 |
+
"baseUrl": "./",
|
| 17 |
+
"incremental": true,
|
| 18 |
+
"skipLibCheck": true,
|
| 19 |
+
"strictNullChecks": true,
|
| 20 |
+
"forceConsistentCasingInFileNames": true,
|
| 21 |
+
"noImplicitAny": false,
|
| 22 |
+
"strictBindCallApply": false,
|
| 23 |
+
"noFallthroughCasesInSwitch": false
|
| 24 |
+
}
|
| 25 |
+
}
|
api/views/dashboard.hbs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>HRHUB - HR Matching System</title>
|
| 6 |
+
<link rel="stylesheet" href="/css/style.css">
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<div class="container">
|
| 10 |
+
<h1>🏢 HRHUB - HR MATCHING SYSTEM</h1>
|
| 11 |
+
<p>Bilateral Matching Engine</p>
|
| 12 |
+
<div class="status">
|
| 13 |
+
<p>✅ NestJS + Handlebars working!</p>
|
| 14 |
+
<p>Candidate: {{candidateName}}</p>
|
| 15 |
+
</div>
|
| 16 |
+
</div>
|
| 17 |
+
</body>
|
| 18 |
+
</html>
|
requirements.txt
CHANGED
|
@@ -4,4 +4,4 @@ numpy==1.26.3
|
|
| 4 |
plotly==5.18.0
|
| 5 |
pyvis==0.3.2
|
| 6 |
scikit-learn==1.4.0
|
| 7 |
-
sentence-transformers==2.3.1
|
|
|
|
| 4 |
plotly==5.18.0
|
| 5 |
pyvis==0.3.2
|
| 6 |
scikit-learn==1.4.0
|
| 7 |
+
sentence-transformers==2.3.1
|