The 2nd project what I did with Nodejs, Express & TypeScript.
- Node.js
- Express
- Concurrently
- Typescript
- mongodb
Generate Private key & Public Key for the app to authenticate using the keys generated to sign the token.
openssl genrsa -des3 -out private.pem 2048
then generate public key from private.pem
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
-
Rename the keys with extenstion .key
-
Move All the files to the root of the app & also change the format of key if its not .key!
PORT=// Your app port here for development
SECRET=// app secret used to sign the keys (Required)
TOKEN_EXP=// Token expiry time in seconds, default=3600
RT_EXPIRY=// Refresh token expiry time in seconds, default=2*TOKEN_EXPIRY
DB_USER=// MongoDB Username
DB_PASS=// MongoDB Password
DB_PORT=// MongoDB Server Port
DB_HOST=// Atlas DB url or your hosted url endpoint
To use the environment variables use dotenv.config() to access the values or else it's undefined!
Use the package manager [YARN] or [NPM] to install [App].
First, Install API image classification: Here
Edit src/constant/index.ts
git clone https://github.com/sande265/node-typescript-starter.git
cd node-typescript-starter
yarn install || npm install
npm install -g nodemon
npm install -g ts-node
npm install -g typescript
npm install
yarn dev // using concurrently to compile TS to JS & run dev server.
yarn build // For production
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.