Code Monkey home page Code Monkey logo

restapi-employeemanagement's Introduction

EmployeeManagement-SpringBoot

Employee Management Application

Technologies:- I.Backend:- • Java • Spring Boot II. Frontend:- • HTML & CSS • JavaScript • Angular & TypeScript III. Other:- • HTTP • CLI • Database • Postman

//Notes//

Backend • The model ‘Employee’ class is implementing ‘Serializable’ because ‘Serializable’ helps transform java class into different types of streams, because this class is going to be saved in a database and then its going to be sent to the front as JSON so its always best to make classes that are going to be in different kinds f stream implemented ‘Serializable’ because it helps with this whole process. • @Column(nullable = false, updatable = false) This means column value can not null and can not be updated once set.

CorsFilter • Cross-Origin Resource Sharing (CORS) is a security concept that allows restricting the resources implemented in web browsers. • It prevents the JavaScript code producing or consuming the requests against different origin. • For example, your web application is running on 8080 port and by using JavaScript you are trying to consuming RESTful web services from 9090 port. Under such situations, you will face the Cross-Origin Resource Sharing security issue on your web browsers. • Two requirements are needed to handle this issue – o RESTful web services should support the Cross-Origin Resource Sharing. o RESTful web service application should allow accessing the API(s) from the 8080 port.

Frontend • Base url is stored in environment folder in environment file of development, since we are in localhost right now. o ‘environment.ts’  environment file for development o ‘environment.prod.ts’  environment file for production

• //service code • public getEmployees() { • this.employeeService.getEmployees().subscribe( • (respose: Employee[]) => { • this.employees = respose; • }, • (error: HttpErrorResponse) => { • alert(error.message); • } • ); • In above code, since getEmployee service is an observable its gonna make a request over the internet or or the network and its gonna take some time that’s why it returns an observable, so we need to subscribe to that observable. So that we can be notified when some data comes ack from server (either employees or some kind of error). • Inside subscribe we have two possible scenarios, either we get response from server or we get error. • ‘=>{} ‘ kind of defines an inline function telling what to do when we get response or error. • If we get response then we store it in employees array in component and if we get error we send it to alert.

restapi-employeemanagement's People

Contributors

rohinighare avatar

Watchers

 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.