-
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.
- Loading branch information
1 parent
50b460f
commit b3c13e0
Showing
15 changed files
with
500 additions
and
100 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,104 +1,110 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# 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 | ||
### config ### | ||
.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 | ||
### yarn ### | ||
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored | ||
|
||
.yarn/* | ||
!.yarn/releases | ||
!.yarn/plugins | ||
!.yarn/sdks | ||
!.yarn/versions | ||
yarn.lock | ||
|
||
# if you are NOT using Zero-installs, then: | ||
# comment the following lines | ||
!.yarn/cache | ||
|
||
# and uncomment the following lines | ||
# .pnp.* | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/yarn | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
/out-tsc | ||
/*/dist | ||
/*/tmp | ||
/*/out-tsc | ||
# Only exists if Bazel was run | ||
/bazel-out | ||
/*/bazel-out | ||
|
||
# settings | ||
app-settings.js | ||
|
||
#package lock | ||
package-lock.json | ||
/*/package-lock.json | ||
|
||
#vscode settings | ||
/.vscode | ||
/*/.vscode | ||
|
||
# dependencies | ||
/node_modules | ||
/*/node_modules | ||
|
||
# profiling files | ||
chrome-profiler-events*.json | ||
speed-measure-plugin*.json | ||
/*/chrome-profiler-events*.json | ||
/*/speed-measure-plugin*.json | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
/*/.idea | ||
/*/.project | ||
/*/.classpath | ||
/*/.c9/ | ||
/*/*.launch | ||
/*/.settings/ | ||
/*/*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history/* | ||
/*/.vscode/* | ||
/*/!.vscode/settings.json | ||
/*/!.vscode/tasks.json | ||
/*/!.vscode/launch.json | ||
/*/!.vscode/extensions.json | ||
/*/.history/* | ||
|
||
# misc | ||
/.sass-cache | ||
/connect.lock | ||
/coverage | ||
/libpeerconnection.log | ||
npm-debug.log | ||
yarn-error.log | ||
testem.log | ||
/typings | ||
/*/.sass-cache | ||
/*/connect.lock | ||
/*/coverage | ||
/*/libpeerconnection.log | ||
/*/npm-debug.log | ||
/*/yarn-error.log | ||
/*/testem.log | ||
/*/typings | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
/*/.DS_Store | ||
/*/Thumbs.db |
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,73 @@ | ||
{ | ||
"name": "api-rest-ts", | ||
"version": "1.0.0", | ||
"description": "A TypeScript simple application template", | ||
"main": "bin/index.ts", | ||
"scripts": { | ||
"start": "npm run build && node ./dist/index.js", | ||
"clean": "rm -Rf ./dist", | ||
"build": "npm run clean && tsc && cp ./src/.env ./dist/.env", | ||
"build2": "npm run clean && tsc && cp ./src/.env ./dist/.env && cp -R ./src/storage ./dist", | ||
"watch": "tsc-watch --onSuccess \"npm start\"", | ||
"serve": "npm run build && npm run seed && npm run start", | ||
"test": "jest --detectOpenHandles", | ||
"test-watch": "tsc-watch --onSuccess \"npm test\"", | ||
"seed": "node ./dist/bin/seeder" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/DouglasMarq/NITRA-BOT/" | ||
}, | ||
"keywords": [ | ||
"template", | ||
"node", | ||
"express", | ||
"simple", | ||
"github", | ||
"typescript" | ||
], | ||
"author": "Douglas Marques Alves <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/DouglasMarq/NITRA-BOT/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.31", | ||
"typescript": "^4.2.4" | ||
}, | ||
"dependencies": { | ||
"@discordjs/opus": "^0.5.0", | ||
"@typeit/discord": "^4.0.9", | ||
"@types/body-parser": "^1.19.0", | ||
"@types/compression": "^1.7.0", | ||
"@types/config": "0.0.38", | ||
"@types/cors": "^2.8.10", | ||
"@types/express": "^4.17.11", | ||
"@types/express-enforces-ssl": "^1.1.1", | ||
"@types/jsonwebtoken": "^8.5.0", | ||
"@types/lodash": "^4.14.168", | ||
"@types/mongoose": "^5.10.3", | ||
"body-parser": "^1.19.0", | ||
"compression": "^1.7.4", | ||
"config": "^3.3.4", | ||
"cors": "^2.8.5", | ||
"discord.js": "^12.5.3", | ||
"dotenv": "^8.2.0", | ||
"express": "^4.17.1", | ||
"express-enforces-ssl": "^1.1.0", | ||
"global": "^4.4.0", | ||
"helmet": "^4.4.1", | ||
"inversify": "^5.0.5", | ||
"joi": "^17.4.0", | ||
"jsonwebtoken": "^8.5.1", | ||
"lodash": "^4.17.21", | ||
"mongoose": "^5.11.18", | ||
"reflect-metadata": "^0.1.13", | ||
"ts-node": "^9.1.1", | ||
"tsc": "^1.20150623.0", | ||
"tsc-watch": "^4.2.9", | ||
"tslib": "^2.2.0", | ||
"winston": "^3.3.3", | ||
"ytdl-core": "^4.5.0" | ||
} | ||
} |
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,10 @@ | ||
DB_NAME= | ||
DB_HOST= | ||
DB_PORT= | ||
DB_USER= | ||
DB_PASS= | ||
SERVER_PORT= | ||
SERVER_HOST= | ||
SERVER_NAME= | ||
DISCORD_TOKEN= | ||
BOT_PREFIX= |
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,23 @@ | ||
import 'reflect-metadata'; | ||
import { Container } from 'inversify'; | ||
import Server from '../server'; | ||
import Mongo from './database'; | ||
import { Logger } from 'winston'; | ||
import Core from '../core'; | ||
import Events from '../events' | ||
import Message from '../events/message' | ||
import Log from '../util/log' | ||
|
||
let container = new Container(); | ||
|
||
export default function bindContainers() { | ||
// let logger = newLogger(config.get("logger.file")); | ||
|
||
container.bind<Server>(Server).to(Server).inSingletonScope(); | ||
container.bind<Log>(Log).to(Log).inSingletonScope(); | ||
container.bind<Core>(Core).to(Core).inSingletonScope(); | ||
container.bind<Events>(Events).to(Events).inSingletonScope(); | ||
container.bind<Message>(Message).to(Message).inSingletonScope(); | ||
|
||
return container; | ||
} |
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,32 @@ | ||
import { injectable } from 'inversify'; | ||
import { connection, connect, disconnect } from 'mongoose'; | ||
import config from 'config'; | ||
|
||
@injectable() | ||
export default class Mongo { | ||
constructor() { | ||
console.log('Conectando ao MongoDB'); | ||
connection.on('error', console.error.bind(console, 'connection error:')); | ||
connect( | ||
`mongodb+srv://${config.get('database.main.user')}:${config.get( | ||
'database.main.pass' | ||
)}@${config.get('database.main.host')}/${config.get( | ||
'database.main.name' | ||
)}?retryWrites=true&w=majority`, | ||
{ | ||
useNewUrlParser: true, | ||
useCreateIndex: true, | ||
useUnifiedTopology: true, | ||
useFindAndModify: true, | ||
}, | ||
(err) => { | ||
if (err) { | ||
console.log(err); | ||
disconnect(); | ||
} else { | ||
console.log(`MongoDB succesfully connected at port ${config.get('database.main.port')}`); | ||
} | ||
} | ||
); | ||
} | ||
} |
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,14 @@ | ||
import Server from '../server/index'; | ||
import bindContainers from '../bin/container'; | ||
import Mongo from './database'; | ||
|
||
export const start = () => { | ||
|
||
let container = bindContainers(); | ||
//Inicialização HTTP | ||
container.get<Server>(Server) | ||
//Inicialização mongo | ||
// container.get<Mongo>(Mongo); | ||
}; | ||
|
||
export default start(); |
Oops, something went wrong.