0

I want to create an application i.e svg-edit that use javascript for client side operations but I want to integrate it with ExpressJS.

Task needed: 1. User Authentication page 2. After authentication depending on the user name the user is directed to the svg-edit page but the background image and the svg is the value from the database. 3. Auto saving and saving on close.

For this I have using ExpressJS and svg-edit 2.6.

My Approach: 1. I will create a page auth.html in /views of Expresss 2. Post the page and in the route handler authenticate it and then redirect to the svg-edit.html the whole folder with all its related .js files are put into /views so it will redirect it.

The porblem is that when server redirects i want to send the image location, username to the svg-edit.html page so that it changes the background w.r.t the value gained.

What is the best way to do such an operation.

Since I am new at ExpressJs so before writing the code. I need suggestion for the structure.

Zeeshan
  • 858
  • 4
  • 16
  • 30
  • There are really lots of ways to do it ... I would load svg-edit async in a app window ... but this is just one of many solutions. – rafaelcastrocouto Nov 27 '13 at 19:05
  • I want to use the MVC structure.. or the easiest way can you advice a way which is easy and on which i can easily change the background image of svg-editor on the basis of users from server – Zeeshan Nov 28 '13 at 17:57
  • The problem is that the background of the svgedit can be changed from the javascript of the client side so how can i send the value from server after auth that can make my svg_edit.html dependent javascript value change – Zeeshan Nov 28 '13 at 18:03
  • 1
    as I said you can use an async ajax (http://api.jquery.com/category/ajax/) or you can use websockets, they are faster but have less browser support(http://caniuse.com/#feat=websockets). You can also use good and old html forms. – rafaelcastrocouto Nov 28 '13 at 18:41
  • ok thanks I will use ajax to fetch the data from server and mention the routes on express. I was confused with MVC structure that how it fits in the MVC structure. – Zeeshan Nov 28 '13 at 18:45
  • you should take a look at this great article about javascript patterns ... http://addyosmani.com/resources/essentialjsdesignpatterns/book/#antipatterns – rafaelcastrocouto Nov 29 '13 at 11:05

0 Answers0