Small backend REST API example for node written in typescript and with jwt authentication.
Open a terminal and clone the repository into your folder:
git clone [email protected]:malahmen/node-ts-be.git
Create a .env file in the root folder.
touch .env
Define the following variables in it:
HOST='localhost'
PORT='3000'
DB_HOST='127.0.0.1'
DB_PORT='59535'
DB_USER='root'
DB_PASSWORD='your-password'
DB_NAME='your-database-name'
DB_DIALECT='mysql'
AUTH_SECRET='this-is-here-only-for-development-purposes'
AUTH_TOKEN_TTL='86400'
I had a kubernetes service runing on localhost, hence the DB_HOST
and DB_PORT
values.
If you have a local mysql DB, just use localhost
and 3306
as values.
Run the following command:
npm i
Open a terminal in the root folder and run the command:
cls && npm run dev