Giter VIP home page Giter VIP logo

cadastro-api's Introduction

Cadastro-api

Simple CRUD using a RESTfull application, where we knowingly call backend Java8, Spring rest, MVC, Spring Tools, MySql, MySql Workbench, FlyWey. The other part, frontend has not yet been implemented, but soon I hope to start it and make it available. In short, the backend is responsible for providing a web service that can be called through a URL and responding to what was requested in JSON.

Technologies and Prerequisites

  • Java 1.8
  • Maven 3.3.9
  • Spring Tool Suite – Version 2.1.2.RELEASE
  • Spring Boot: 2.1.2.RELEASE

Installing and Step to do

  • Create Spring Boot project & add Dependencies
  • Configure Spring JPA
  • Create DataModel Class Funcionario
  • Create Spring JPA Repository Interface “FuncionarioRepository”
  • Create Web Controller “FuncionarioController”
  • Create MySQL table
  • Run Spring Boot Application & Enjoy Result

Classes, Interfaces and methods

  • Funcionario class corresponds to entity and table funcionario.
  • FuncionarioRepository is an interface extends CrudRepository, will be autowired in funcionarioController for implementing repository methods and custom finder methods.
  • FuncionarioController is a REST Controller which has request mapping methods for RESTful requests such as:
    • buscar,
    • adicionar,
    • atualizar,
    • remover.
  • Configuration for Spring Datasource and Spring JPA properties in application.properties
  • Dependencies for Spring Boot and MySQL in pom.xml

application.properties Configuration for Spring Datasource & JPA properties

spring.datasource.url=jdbc:mysql://localhost:3306/cadastro?useSSL=false
spring.datasource.username=root
spring.datasource.password=12xyz
spring.jpa.generate-ddl=true

Our Spring Boot Server can work with MySQL Database and provides APIs:

GET /funcionarios/: get all funcionario
GET /funcionarios/[id]: get a funcionario by id
POST /funcionarios/: save a funcionario
PUT /funcionarios/[id]: update a funcionario by id
DELETE /funcionarios/[id]: delete a funcionario by id

cadastro-api's People

Contributors

fvneto avatar

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.