AngularJS is a single page application framework that is - without
doubt - exponentially growing. But as exposed, it is a client-side
framewok, so we need something to back it up if we want anything
related to persistence! But why would I choose Java and a SQL? That's
right, I ask you the same question (wait what?). What I mean by saying
this is that AngularJS works better with a NoSQL database, in other
words, more challenges, since most Java stuff out there is based on
SQL databases.
With this in mind, you would find most of the tutorials/explanations
back-end utilizing NodeJS, PHP or Ruby on Rails, and that is for
innumerous reasons that it would need another tutorial to start
explaining why, if you want to read about it, see here
and here.
Before I start, I'm assuming you know the basics of Java
language and at least what AngularJS is, not exactly any experience
with it. In this tutorial, we will create a "Hello World" - using
NetBeans 8.1 - WebService with Java to "read" a HTTP method, more
specifically a GET. So, let's start out from the back-end, creating a
new Web Application (using GlassFish as the server).
Defining GLASSFISH as Server and Java EE version
Now we can create a RESTful Web Services from Pattern
DON'T PANIC if you are using other IDE or doesn't want to do any of
this, the project file is at the end of this
tutorial. The explications of every method/class is inside each
img/file as well.
Setting up the application config
WebService resource class
Angular import and definition in a simple index
Now we can effectively run the project
That's it, easy peasy. Now that you have a connection to the
back-end, you can easily set-up simple projects (like portfolios).
Author: Guilherme Carlos Matuella
GitHub project: (Didn't created it yet)







Ótimo tutorial, com este material deixamos de perder tempo procurando como fazer e aumentamos nossa produtividade ao desenvolver de fato o projeto.
ResponderExcluir