Code Monkey home page Code Monkey logo

product-service-api's Introduction

product-service-api Microservice

This repository contains a Spring Boot project named product-service-api. The project is built using Maven and includes controllers, a repository, a service, and exception handling.

Table of Contents

Overview

The project consists of a Spring Boot application with the following components:

  1. Main Application Class: ProductServiceApiApplication

    • Entry point for the application.
    • Annotated with @SpringBootApplication.
  2. Controller Class: ProductController

    • RESTful controller handling product-related requests.
  3. Aspect Class: CategoryController

    • RESTful controller handling category-related requests.

Project Structure

Usage

  1. Clone the repository:

    git clone https://github.com/ashwani-cse/product-service-api.git
  2. Build the project:

    mvn clean install -U

-U: It is a optional to update snapshots and releases. 3. Run the application:

```bash
mvn spring-boot:run
```
  1. Access the API:

    Open a web browser or a tool like Postman and make a GET request to http://localhost:8080/products/.

SQL Queries executed

CREATE DATABASE IF NOT EXISTS product_service_flywaydb;
CREATE USER IF NOT EXISTS product_service_flywaydb_user IDENTIFIED BY 'product_service_flywaydb_pass';
GRANT ALL PRIVILEGES ON product_service_flywaydb.* TO product_service_flywaydb_user;

Make some security changes before exposing application to user. Because you may be exposed to SQL injection attacks.

  • Command to revoke all the privileges from the user associated with the application:
     revoke all on product_service_flywaydb.* from 'product_service_flywaydb_user';
  • And give some necessary privileges to application to make changes to only data of the database.
     grant select, insert, delete, update on product_service_flywaydb.* to 'product_service_flywaydb_user';

When you want to make changes to the database:

  • Re-grant permissions.
  • Change the spring.jpa.hibernate.ddl-auto = update
  • Re-run your applications.

Then repeat the two commands shown here to make your application safe for production use again. Better still, use a dedicated migration tool, such as Flyway or Liquibase.

OWASP Dependency-Check tool :

This is a popular open-source tool that helps identify project dependencies and check if they have known, publicly disclosed, vulnerabilities. To identify and report known vulnerabilities in the dependencies of a Maven-based project execute below command -

 mvn dependency-check:check 

Note: Use the NVD API key for fast scanning.

If you see any vulnerability, try to update with latest version of that dependency. In this project i found vulnerability with jackson-databind-core in 2.15.x versions. So i updated pom with dependency management with latest jackson-databind core version.

Note: for github use to commit/push and pull create a token from developer settings then in-place of password enter that token. Because from 2021, password has disabled for security reason.

Stay Connected

Connect with us on social media and stay updated with the latest news and developments:

Subscribe to our Newsletter

Stay ahead of the curve by subscribing to our LinkedIn newsletter:

Experience the future of e-commerce with CommerceNexus - where innovation meets efficiency!

product-service-api's People

Contributors

ashwani-cse avatar

Stargazers

 avatar

Watchers

 avatar

product-service-api's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.