Skip to content

This project aims to develop simple CRUD application in Node.js with JWT Auth, Unit Tests, Knex migration, Docker and GitlabCI and other Tech.

Notifications You must be signed in to change notification settings

bhatt-deep/crud-app-nodeJs

Repository files navigation

Course Project

Complete Project

Setup

  1. Clone this repository to your local machine.
  2. Run npm install to ensure all dependencies are installed.
  3. Create a mysql database.
  4. Setup .env file with below variables.
  • DB_HOST
  • DB_USER
  • DB_PASSWORD
  • DB_NAME
  • PORT
  • JWT_SECRET
  1. run the migrations. node_modules/.bin/knex --esm migrate:latest
  2. Run npm start to run the script.
  3. Run npm test to run the test cases.

CI/CD Setup

This project is configured to support CI/CD on Google CLoud Run. To Enable this functionality, you have to configure few environment variables as below:

  1. DEPLOY_KEY_FILE_PRODUCTION
  2. CLOUDSQL_CONNECTION_NAME
  3. DATABASE_USER
  4. dbname
  5. dbpass
  6. PROJECT_ID_PRODUCTION
  7. SERVICE_NAME

To implement the required infrastructure for this project, you can use this Terraform repository.

After implementing the infrastructure, you can create a new branch and make some changes in to it and then merge it to master branch. So as soon as the pipelines succeed, the new changes will be deployed to Google CLoud run.

project demo url:

https://course-project-k6y7krefqa-nn.a.run.app

REST API list

  1. POST : /users
  2. GET : /users
  3. GET : /users/:id
  4. PUT : /users/:id
  5. POST : /entries
  6. GET : /entries (Protected)
  7. GET : /entries/:id (Protected)
  8. PUT : /entries/:id (Protected)

The Protected APIs required bearer token to execute.

About

This project aims to develop simple CRUD application in Node.js with JWT Auth, Unit Tests, Knex migration, Docker and GitlabCI and other Tech.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published