geekyants / express-typescript Goto Github PK
View Code? Open in Web Editor NEWExpress + TypeScript + Boilerplate for Web / API App
Home Page: https://geekyants.github.io/express-typescript/
License: MIT License
Express + TypeScript + Boilerplate for Web / API App
Home Page: https://geekyants.github.io/express-typescript/
License: MIT License
Describe the bug
The app fails to run or start a connection to a mongodb url because of a deprecated option being set.
To Reproduce
Steps to reproduce the behavior:
yarn dev
or npm run dev
Expected behavior
The Application fails to start
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A
Additional context
For versions of Mongoose >= 6, setting useCreateIndex
is invalid, and this boilerplate uses >=6.4.6
Describe the bug
The application throws a rejection which i believe has to do with the sessions package trying to make updates to mongodb on start. Full error log below
[WARN] UnhandledPromiseRejectionWarning: MongoError: (Unauthorized) not authorized on admin to execute command { insert: "system.indexes", documents: [[{ns admin.sessions} {key [{expires 1}]} {name expires_1} {expireAfterSeconds 0} {unique false}]], ordered: true }
at Function.MongoError.create (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/error.js:31:11)
at /Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:497:72
at authenticateStragglers (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:443:16)
at Connection.messageHandler (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/pool.js:477:5)
at TLSSocket.<anonymous> (/Users/user/Documents/projects/express-typescript/node_modules/mongodb-core/lib/connection/connection.js:333:22)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at TLSSocket.Readable.push (internal/streams/readable.js:206:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
at processPromiseRejections (internal/process/promises.js:247:11)
at processTicksAndRejections (internal/process/task_queues.js:96:32)
To Reproduce
Steps to reproduce the behavior:
yarn dev
or npm run dev
Expected behavior
App Should start
Screenshots
N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A
Additional context
Cannot use this template with session
for App.ts is loadQueue function:
1.const isQueueMonitorEnabled: boolean = Locals.config().queueMonitor;
2.const queueMonitorPort: number = Locals.config().queueMonitorHttpPort;
But .env not find queueMonitor and queueMonitorHttpPort
Describe the bug
When running npm install locally, I get a dependency conflict when resolving the dependency tree
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR! dev typescript@"5.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"^2.7 || ^3" from [email protected]
npm ERR! node_modules/awesome-typescript-loader
npm ERR! dev awesome-typescript-loader@"^5.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/lennart/.npm/_logs/2023-06-19T11_22_57_010Z-eresolve-report.txt
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Npm install is able to run without error
Desktop (please complete the following information):
Describe the bug
This repo does not build. complains about ./tsconfig.json not found. but its there.
PS C:\Users\a\Desktop\deleteme2\express-typescript> npm run build
> [email protected] build
> tsc --project './tsconfig.json'
error TS5058: The specified path does not exist: ''./tsconfig.json''.
if i do nox tsc
in the project i get 311 errors something to do with mongoose mostly.
....
node_modules/mongoose/types/expressions.d.ts:2880:20 - error TS1110: Type expected.
2880 type UTCOffset = `${hh}` | `${hh}${mm}` | `${hh}:${mm}`;
~~~
node_modules/mongoose/types/pipelinestage.d.ts:220:82 - error TS1110: Type expected.
220 $replaceWith: ObjectExpressionOperator | { [field: string]: Expression } | `$${string}`;
~~~~
node_modules/mongoose/types/pipelinestage.d.ts:297:1 - error TS1128: Declaration or statement expected.
297 }
~
Found 311 errors.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
it should build and produce dist folder
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Describe the bug
Getting the error while npm run dev
`[06:59:17] File change detected. Starting incremental compilation...
src/controllers/Auth/Login.ts:52:30 - error TS2339: Property 'returnTo' does not exist on type 'Session & Partial'.
52 res.redirect(req.session.returnTo || '/account');
~~~~~~~~
src/models/User.ts:72:30 - error TS2339: Property 'fullname' does not exist on type 'Document<any, any, any>'.
72 const fulladdress = ${this.fullname.trim()} ${this.geolocation.trim()}
;
~~~~~~~~
src/models/User.ts:72:54 - error TS2339: Property 'geolocation' does not exist on type 'Document<any, any, any>'.
72 const fulladdress = ${this.fullname.trim()} ${this.geolocation.trim()}
;
~~~~~~~~~~~
src/models/User.ts:78:40 - error TS2339: Property 'password' does not exist on type 'Document<any, any, any>'.
78 bcrypt.compare(_requestPassword, this.password, (_err, _isMatch) => {
~~~~~~~~
src/models/User.ts:90:13 - error TS2339: Property 'email' does not exist on type 'Document<any, any, any>'.
90 if (! this.email) {
~~~~~
src/models/User.ts:94:51 - error TS2339: Property 'email' does not exist on type 'Document<any, any, any>'.
94 const md5 = crypto.createHash('md5').update(this.email).digest('hex');
~~~~~
src/providers/Express.ts:63:29 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(_error: any) => void' is not assignable to parameter of type '() => void'.
63 this.express.listen(port, (_error: any) => {
~~~~~~~~~~~~~~~~~~
node_modules/@types/express-serve-static-core/ts4.0/index.d.ts:1115:5
1115 listen(handle: any, listeningListener?: () => void): http.Server;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
src/routes/Web.ts:40:27 - error TS2339: Property 'returnTo' does not exist on type 'Session & Partial'.
40 res.redirect(req.session.returnTo || '/');
~~~~~~~~
[06:59:19] Found 8 errors. Watching for file changes.
src/controllers/Auth/Login.ts:52:30 - error TS2339: Property 'returnTo' does not exist on type 'Session & Partial'.
52 res.redirect(req.session.returnTo || '/account');
~~~~~~~~
src/models/User.ts:72:30 - error TS2339: Property 'fullname' does not exist on type 'Document<any, any, any>'.
72 const fulladdress = ${this.fullname.trim()} ${this.geolocation.trim()}
;
~~~~~~~~
src/models/User.ts:72:54 - error TS2339: Property 'geolocation' does not exist on type 'Document<any, any, any>'.
72 const fulladdress = ${this.fullname.trim()} ${this.geolocation.trim()}
;
~~~~~~~~~~~
src/models/User.ts:78:40 - error TS2339: Property 'password' does not exist on type 'Document<any, any, any>'.
78 bcrypt.compare(_requestPassword, this.password, (_err, _isMatch) => {
~~~~~~~~
src/models/User.ts:90:13 - error TS2339: Property 'email' does not exist on type 'Document<any, any, any>'.
90 if (! this.email) {
~~~~~
src/models/User.ts:94:51 - error TS2339: Property 'email' does not exist on type 'Document<any, any, any>'.
94 const md5 = crypto.createHash('md5').update(this.email).digest('hex');
~~~~~
src/providers/Express.ts:63:29 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(_error: any) => void' is not assignable to parameter of type '() => void'.
63 this.express.listen(port, (_error: any) => {
~~~~~~~~~~~~~~~~~~
node_modules/@types/express-serve-static-core/ts4.0/index.d.ts:1115:5
1115 listen(handle: any, listeningListener?: () => void): http.Server;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
src/routes/Web.ts:40:27 - error TS2339: Property 'returnTo' does not exist on type 'Session & Partial'.
40 res.redirect(req.session.returnTo || '/');
~~~~~~~~`
To Reproduce
Steps to reproduce the behavior:
"compilerOptions": { "target": "es6", "module": "commonjs", "outDir": "dist/", "sourceMap": true, "skipLibCheck": true }, "files": [ "./node_modules/@types/mocha/index.d.ts", // "./node_modules/@types/node/index.d.ts", // "./node_modules/@types/mongoose/index.d.ts", // "./node_modules/@types/mongodb/index.d.ts", "./node_modules/@types/express/index.d.ts", "./node_modules/@types/dotenv/index.d.ts", "./node_modules/@types/express-session/index.d.ts" ],
Expected behavior
Should start without these error
When I make any changes in the /controller
directory, they do not get reflected in the api request itself
example: changed under /controllers/Api/Home.ts
class Home {
public static index(req, res, next): any {
return res.json({
message: "hi", // Locals.config().name,
});
}
}
but the API response is still the name of the app not "hi" unless I restart the docker container.
Describe the bug
fresh install starts with errors
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/faizahmedfarooqui/nodets.git;
cd nodets;
npm install;
vim .env;
npm run dev;
Desktop (please complete the following information):
Additional context
[20:35:47] Starting compilation in watch mode...
node_modules/@types/node/index.d.ts:64:11 - error TS2300: Duplicate identifier 'IteratorResult'.
64 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
node_modules/@types/node/index.d.ts:83:15 - error TS2451: Cannot redeclare block-scoped variable 'custom'.
83 const custom: symbol;
~~~~~~
node_modules/@types/node/ts3.2/util.d.ts:6:15
6 const custom: unique symbol;
~~~~~~
'custom' was also declared here.
node_modules/@types/node/ts3.2/util.d.ts:9:15
9 const custom: unique symbol;
~~~~~~
and here.
node_modules/@types/node/index.d.ts:86:15 - error TS2451: Cannot redeclare block-scoped variable 'custom'.
86 const custom: symbol;
~~~~~~
node_modules/@types/node/ts3.2/util.d.ts:6:15
6 const custom: unique symbol;
~~~~~~
'custom' was also declared here.
node_modules/@types/node/ts3.2/util.d.ts:9:15
9 const custom: unique symbol;
~~~~~~
and here.
node_modules/@types/node/ts3.2/util.d.ts:6:15 - error TS2451: Cannot redeclare block-scoped variable 'custom'.
6 const custom: unique symbol;
~~~~~~
node_modules/@types/node/index.d.ts:83:15
83 const custom: symbol;
~~~~~~
'custom' was also declared here.
node_modules/@types/node/index.d.ts:86:15
86 const custom: symbol;
~~~~~~
and here.
node_modules/@types/node/ts3.2/util.d.ts:9:15 - error TS2451: Cannot redeclare block-scoped variable 'custom'.
9 const custom: unique symbol;
~~~~~~
node_modules/@types/node/index.d.ts:83:15
83 const custom: symbol;
~~~~~~
'custom' was also declared here.
node_modules/@types/node/index.d.ts:86:15
86 const custom: symbol;
~~~~~~
and here.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
node_modules/@types/node/index.d.ts:64:11
64 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
[20:35:51] Found 6 errors. Watching for file changes.
Describe the bug
Getting `error TS6053: File '/Users/**/node_modules/@types/mongoose/index.d.ts' not found. while starting npm run dev
[06:19:09] Found 1 error. Watching for file changes.`
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should start without error
(removed the template, as this is a generic error, not a functional one).
Check Dockerfile
:
# Run node server
CMD npm run start
check package.json
:
"scripts": {
"build": "tsc --project './tsconfig.json'",
"dev": "tsc --project './tsconfig.json' --watch & NODE_ENV=development nodemon dist",
"test": "tsc --project './tsconfig.json' && ./node_modules/.bin/mocha dist/**/*.spec.js",
"lint": "./node_modules/.bin/tslint -c tslint.json 'src/**/**.ts'"
}
notice, there's no declared command with the name of start
.
Describe the bug
I cant start the app on Manjaro I3.
I clone the repo, then install node packages with yarn and finally i
sudo yarn dev
sudo npm run dev
and i get this error:
[15:57:43] Starting compilation in watch mode...
src/providers/Express.ts:63:29 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type '(_error: any) => void' is not assignable to parameter of type '() => void'.
63 this.express.listen(port, (_error: any) => {
~~~~~~~~~~~~~~~~~~
node_modules/@types/express-serve-static-core/index.d.ts:1036:5
1036 listen(handle: any, listeningListener?: () => void): http.Server;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
[15:57:47] Found 1 error. Watching for file changes.
TSC is a deprecated package, your repo is confusing sample.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.