Tutorial : Angular.js and Node.js

Hello everybody!

Angular.js

In this post, I will share my experience on making a javascript using AngularJS. I use WEBSTORM IDE that is created by Jetbrain.

1. I use Angular Template that is provided by the IDE.
2. Put the file inside the XAMPP folder because you want to connect it to the database.
3. Try to run the simple code as a tester by using localhost/… (depends on the path of the folder).
4. Run the node server that is provided the service to GET, DELETE, INSERT the database.
5. Create a folder name app.
6. Insert the assets folder, css folder inside the app folder.
7. Create the index.html
1. index.html consist the static of the website that you don’t want to change.
8. Create a folder inside app folder name #anything and create html file and js file in one folder.
9. Put the view (html code) in the html file.
10. in js file, i put the service there.

click here for image

click here for image

click here for image

11. after making the service, put the name of the js in the app.js outside those file. (you can change the first view in the redirectTo to another page. In the picture it will redirect to the login page.

Click here for image

12. run the program again by using localhost/…
13. and you are DONE 🙂

Node.js

for node.js, i use Intellij IDE.

  1. Download & Install Node.js
  2. Create your project folder
  3. Open terminal directed to the project folder and type :
  • npm install –save sequelize (ORM for node js) : ORM -> object relational model,  used to create or define tables in database
  • npm install –save mysql (if you are using mysql)
  • npm install –save express (install express framework for node js)
  1. Create folder models in the project directory
  2. Create your models

*use the word require to use the module installed in the project or the ones you export

  • index.js is used to collect all information of the models inside the models folder so it should be left as it is. Or if it was not created after installing the sequelize module through npm, just copy as the following

Click here for image

  • models can be referred to database tables.

Click here for image

Click here for image

Sequelize.define (‘table’s name’,{

/*fill your table’s variable and properties (Integer, String etc.) using sequlize format as follows*/ } , classMethods : {/*declare your function as you are writing in javascript. Use sequelize.query for normal querying, or use sequlize’s for faster access*/}

  1. Create folder routes in the project directory. This will define the routing of your project.

Click here for image

The 2 most common routing verbs used are get and post. Get is used when user would like to retrieve data as it is, it is mostly used when user have no parameters to give to the API while post is otherwise. Router.get(‘/’) indicates a user trying to retrieve access the ‘/’ url using get verb. If you want to add more function to the routing, you can add in the back of / such as “/view_all_user”, “/add_user:id” and “/add/admin:id”. res.send is a response that will be send by the API back to the browser. The req.body in the post section is the way to get the value from what the browser sends to the server in the post method. The req.params is to get the value from get method. The req.body.id means that it will retrieve the data inside an input sent by the browser with the name of id.

  1. Create routing (app.js) in the project directory

Click here for image

This is what the app.js looks like in intellij IDE, as it already give out the basic requirements in the express framework user might need. But what we need most is the body-parser, express framework, and the routings we have defined earlier.

In this case there are already many routings defined, and in this tutorial we only provide you with one to stimulate your creativity in creating a more efficient routings and database models.

 

Next, is connecting the front end to the API we have created. Don’t forget to run the node js server before running the API. Have a blessed coding day. But before that, we have not created the server have we?

 

  1. Creating the Server.

Create bin folder in the project directory, create a www file (no exstension or anything)

Click here for image

Fill as following. Change the port as need. The default port is 3000.

*Do create the models.sequelize.sync, it is used to test the connection to the database. If you set force : true, it will recreate the database everytime the server start.

Created By :

Scripting Language : Final Project

Hello!

In this post, i will be mainly discussed about website functionality in detail. This website is an e-commerce website of Batik Lasem Pusaka Bering. This website has user site and admin site that has a different purpose and functionality.

Features

User site:

  • Home Page: first page user see when visit this website. it show the advertisement of Batik Lasem and show the 3 newest collections of Batik Lasem Pusaka Bering.
  • Product Page: show all the product and customer can choose the categories based on the Batik itself.
  • About Page: consist of Batik story and Batik Lasem story.
  • Contact Us Page: consist of a map and the details information of Batik Lasem Pusaka Bering
  • Cart Page: consist of the customer’s chosen product with the the total price of each item and total price of all item.
  • Register/Login Page: consist of a form of register to become a member and a form to log in to customer’s account. After Login there is a dropdown menu that consist of:
    • My Profile: show the customer’s profile.
    • My Order: show customer’s order.
    • Log Out: exit from customer’s account.
  • Search button to search the product.

Admin site

  • Home Page: show the landing page.
  • Order:
    • Search Order List: consist of the form to search customer’s order and show all order
    • Search Order Detail: consist of the form, detail of the customer’s order and process customer order whether want to be accepted or denied.
  • Transaction:
    • Search Transaction List: consist of the form to search and show all transaction.
    • Search Transaction Detail: consist of the form and detail of the customer’s transaction history
  • Payment:
    • Search Payment List: consist of the form and detail of the customer’s payment.
    • Search Payment Detail: consist of the form and detail of the customer’s payment
  • Product:
    • Add Product: consist a form to add new product.
    • Search Product: show all, search, edit and delete product.
  • User:
    • Add User: consist of a form to add new user as user or admin.
    • Search User: show all, search, edit and delete user.

preview

<– User –> 

 

Screenshot  1 : Home Page

Screenshot  2 :  Product Page

Screenshot  3 : Help Page

Screenshot  4 : Contact Us Page

Screenshot  5 : Cart Page

Screenshot  6 : Register / Login Page

 

<– Admin –>

Screenshot  7 : Home Page

Screenshot  8 : Order Page

Screenshot  9 : Add Product Page

Screenshot  10 : Payment Page

 

Team Member :

Inggreat Sundjaja

Ivan Patria

Otto Daniel

And, here is the link to see the demo of our project! Hope you like it! ENJOY!

THANK YOU.

 

Project Proposal

We will make a website for a company called Pusaka Beruang. Pusaka beruang sell batik lasem. our website has a based layout and design that created by art and design named MICHELLE, but we are going to use our own template because design that already created is has too much css , too much style on the html and make confuse when develop it. She use muse programming language.

For the Back End, we will use PHP and CodeIgniter as the framework. PHP is server-based scripting for the website. CodeIgniter use MVC Approach(Model-View-Controller) as a project structure. it is easier to develop website using framework such as CodeIgniter because it is already has a structure that we can follow and built-in library that we can use to make website development become more faster and efficient.

we will make all functionality on this website works. functionality that we are going to create are login as customer and admin, register new user, buy items, search item, and submit payment. As there are administrators to manage the website, an administrator page will be created.

In the admin site, there are :

  • Add, Update, Search and Delete inventory,
  • Add, Update, Search and Delete user,
  • Add, Update, Search and Delete transaction

in the user site, there are :

  • Shopping cart
  • Login as user
  • Search item
  • Register as user

in this project, i will handle back end of this website. The job description is i will make all functionality that exist in this website works both user such as login, register, search items and admin such as add, view, search and delete of inventory, user and transaction.

Project Requirement:

  • Use PHP framework. Suggestion: CodeIgniter
  • Create the primary navigation bar (menu) for the site. It may be implemented as an image map or as a table of images, text or buttons.
  • Create a help and login pages.
  • Use appropriate href and/or  alt (if image) tags for each menu item.
  • Use the title tag to create an appropriate title in every page.
  • Create a user registration form.
  • Create a login/user authorization table in a database.
  • Create administrator page(s).
  • Use a shopping cart.
  • The form should contain space for name, address, phone, email, gender etc (but should be appropriate)
  • Utilize the image object and the onMouseOver event or other event to dynamically change images.
  • Define styles using css and use them to give attributes to some html elements.
  • Use a JavaScript function (at least 2 scripts).
  • Use form elements such as text and selection boxes to gather user input/preferences.
  • Use the date object to write the date from the server (you could put anywhere on your web).
  • Create an inventory table in a database.
  • Display inventory by category upon request from the main page.

Logo

img_9030

Name : Otto Daniel

ID         : 1701320352

Team:

  • Inggreat Sundjaja – 1701319722 (Front End Developer)
  • Ivan Patria Yudistira – 17013 (Front End Developer and Back End Developer)
  • Otto Daniel – 1701320352 (Back End Developer)