-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Create a
.envfile and set the required environment variables.MONGO_URI=your_mongodb_url JWT_SECRET=your_jwt_secret -
Build the application:
npm run build
-
Start the application:
npm run start
- Create a
.envfile and set the required environment variables.MONGO_URI=your_mongodb_url JWT_SECRET=your_jwt_secret - Build the Docker image:
docker build -t my-auth-api . - Run the Docker container:
docker run -p 5000:5000 my-auth-api
You can run the app with a MongoDB locally using Docker Compose:
- Create a
.envfile and set the required environment variables.MONGO_URI=mongodb://localhost:27017/myauthapi JWT_SECRET=your_jwt_secret - Run the Docker container:
docker compose up -d