Tutorial : Angular JS and Node JS

Hello everybody!

In this post, I will share our experience on making a javascript using AngularJS. I use WEBSTORM IDE that is created by Jetbrain and also we make a backend using NodeJS by using IntelliJ that is also created by Jetbrain.

AngularJS

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 The Snippet Code of The Service (POST – Add)

Click Here For The Snippet Code of The Service (POST – Delete)

Click Here For The Snippet Code of The Service (POST-Update)

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 The Code Sample

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

Node.js

  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 Languages : Final Project

Hello!

Continuing the last post, this post will explain all the features of the e-commerce website that has been worked properly.

Project Description:
This website is an e-commerce website of Batik Lasem Pusaka Bering. This project was done by Inggreat Sundjaja, Ivan Patria Yudistira, and Otto Daniel. This website has several features such as:

User site:
–  Home Page: show the advertisement of Batik Lasem and show the newest collection 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.
– 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
– Search Order Detail: consist of the form and detail of the customer’s order.
– Transaction:
– Search Transaction List: consist of the form and detail of the customer’s transaction.
– Search Transaction Detail: consist of the form and detail of the customer’s transaction to be confirmed or denied.
– 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 to be confirmed or denied
– Product:
– Add Product: consist a form to add new product.
– Search Product: show all the product and admin can search the product.
– User:
– Add User: consist of a form to add new user.
– Search User: show all the user details and admin can search the user.

Preview :

User

Screenshot 1 : Home Page

Screenshot 1 : Home Page

Screenshot 2: Product Page

Screenshot 2: Product Page

Screenshot 3 : About Page

Screenshot 3 : About Page

Screenshot 4 : Contact Us Page

Screenshot 4 : Contact Us Page

Screenshot 5 : Cart Page

Screenshot 5 : Cart Page

Screenshot 6 : Register/Login Page

Screenshot 6 : Register/Login Page

Admin

Screenshot 7 : Home Page

Screenshot 7 : Home Page

Screenshot 8: Order Page

Screenshot 8: Order Page

Add Product page

Screenshot 9: Add Product page

Add Product page

Screenshot 10: Add Product page

Screenshot 11 : Payment Page

Screenshot 11 : Payment Page

Screenshot 10 : Add User Page

Screenshot 12 : Add User Page

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

THANK YOU.

Scripting Languages : Project Proposal

Hello!

In Scripting Languages course, we have to make an e-commerce website based on Batik Lasem. The design of the website has been created by art and design student named MICHELLE. It mostly made by a monochrome color (black and white color). It has a good design but we planned to change the design because at first the CSS file is too much and makes us confuse. Second, she made with a muse programming language.

In this e-commerce website, we are going to make all the functionality works, we will add new functionality in this website. First we are going to have a login button that there are two types of person as an admin or customer. Since there are 2 types of customer, we make admin site for the person who have role as an admin.

In the Admin site, there are:

  • Add, update, search, and delete inventory table,
  • User information table,
  • Transaction table.

and in the client site (where the customer see and interact with), there are:

  • Shopping cart that works properly,
  • Registration form,
  • Search item,
  • Register as a user.

This website will be developed using PHP framework (Code Igniter) that it has Model View Controller  (MVC) to organised the website. Besides that, we use html to developed the front end of this project and we use bootstrap template.

I will handle the front end of this website. The job description of front end is responsible for implementing visual elements that users see and interact with in a web application. Furthermore, I will provide a website template for the admin side.

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.

Here is some images of Pusaka Beruang, Batik Lasem :

Logo Pusaka Beruang

Batik Lasem

Name : Inggreat Sundjaja

ID         : 1701319722

Team:

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

 

 

Thank you!