Skip to content

Commit

Permalink
Merge pull request #32 from firecamp-dev/feat/echo-server
Browse files Browse the repository at this point in the history
[feat]: Firecamp Echo Server
  • Loading branch information
Nishchit14 committed Aug 4, 2023
2 parents 7a50389 + 34fa6a3 commit 98aa2b5
Show file tree
Hide file tree
Showing 18 changed files with 3,266 additions and 79 deletions.
124 changes: 124 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,128 @@
/tmp
/yarn.lock
node_modules
node_modules
npm-debug.log
.DS_Store

build/
cypress/screenshots
cypress/videos

*.zip
*.crx
*.pem
update.xml
.idea
package-lock.json
*.lock

pnpm-lock.yaml

!packages-executors/http-executor/src/src/cacert.pem
!platform/firecamp-ui/src/declarations.d.ts

.jest-test-results.json

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

oclif.manifest.json
23 changes: 23 additions & 0 deletions packages/firecamp-echo-server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
root: true,
env: {
node: true,
jest: true,
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
104 changes: 104 additions & 0 deletions packages/firecamp-echo-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
1 change: 1 addition & 0 deletions packages/firecamp-echo-server/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
strict-peer-dependencies=false
1 change: 1 addition & 0 deletions packages/firecamp-echo-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Firecamp Echo Server
62 changes: 62 additions & 0 deletions packages/firecamp-echo-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@firecamp/echo-server",
"version": "1.0.0",
"description": "Firecamp Echo Server",
"license": "",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint '{src,apps,libs,test}/**/*.ts' --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "echo 'No e2e tests implemented yet.'"
},
"dependencies": {
"@nestjs/common": "9.0.1",
"@nestjs/core": "9.0.1",
"@nestjs/platform-express": "9.0.1",
"@nestjs/platform-socket.io": "^9.3.2",
"@nestjs/platform-ws": "9.0.1",
"@nestjs/websockets": "9.0.1",
"class-transformer": "0.5.1",
"class-validator": "0.14.0",
"raw-body": "^2.5.2",
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rxjs": "7.5.5",
"socket.io-v2": "npm:socket.io@2.4.1",
"socket.io-v3": "npm:socket.io@3.1.2",
"socket.io-v4": "npm:socket.io@4.5.4",
"ws": "8.8.0"
},
"devDependencies": {
"@nestjs/cli": "9.0.0",
"@nestjs/schematics": "9.0.1",
"@nestjs/testing": "9.0.1",
"@types/express": "4.17.13",
"@types/node": "18.0.3",
"@types/supertest": "2.0.12",
"@types/ws": "8.5.3",
"@typescript-eslint/eslint-plugin": "5.30.5",
"@typescript-eslint/parser": "5.30.5",
"eslint": "8.19.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"jest": "28.1.2",
"prettier": "2.7.1",
"supertest": "6.2.4",
"ts-jest": "28.0.5",
"ts-loader": "9.3.1",
"ts-node": "10.8.2",
"tsconfig-paths": "4.0.0",
"typescript": "4.7.4"
},
"packageManager": "pnpm@7.27.1"
}
13 changes: 13 additions & 0 deletions packages/firecamp-echo-server/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Module } from '@nestjs/common';
import { RestModule } from './rest/rest.module';
import { WebSocketModule } from './websocket/websocket.module';
import { SocketIoModule } from './socket-io/socket-io.module';

@Module({
imports: [
RestModule,
// SocketIoModule,
WebSocketModule,
]
})
export class AppModule { }
15 changes: 15 additions & 0 deletions packages/firecamp-echo-server/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NestFactory } from '@nestjs/core';
import { WsAdapter, } from '@nestjs/platform-ws';
// import { IoAdapter } from '@nestjs/platform-socket.io';
import { AppModule } from './app.module';

async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors();

app.useWebSocketAdapter(new WsAdapter(app));
// app.useWebSocketAdapter(new IoAdapter(app));
await app.listen(3000);
console.log(`Application is running on: ${await app.getUrl()}`);
}
bootstrap();
18 changes: 18 additions & 0 deletions packages/firecamp-echo-server/src/rest/rest.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { RestController } from './rest.controller';

describe('RestController', () => {
let controller: RestController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [RestController],
}).compile();

controller = module.get<RestController>(RestController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});

0 comments on commit 98aa2b5

Please sign in to comment.