V
V
vitaly_742021-06-08 08:28:38
Yii
vitaly_74, 2021-06-08 08:28:38

Am I doing the SSR application structure correctly?

I liked the frontend framework view.
and I would like to ask the following whether it will be right to do this:
build the necessary view components in app.js connect app.js to yii2 and in the form of yii2 already do the following.

<div id="app">
  <form @submit.prevent="submitForm">
 <div>
 <label for="name">Name:</label><br>
 <input id="name" type="text" v-model="name" required/>
 </div>
 <div>
 <label for="email">Email:</label><br>
 <input id="email" type="email" v-model="email" required/>
 </div>
 <div>
 <label for="caps">HOW DO I TURN OFF CAPS LOCK:</label><br>
 <textarea id="caps" v-model="caps" required></textarea>
 </div>
 <button :class="[name ? activeClass : '']" type="submit">Submit</button>
 <div>
 <h3>Response from server:</h3>
 <pre>{{ response }}

and in the form to write the same js code (extend vuejs components) for this view only:
new Vue({
  el: '#app',
  data() {
    return {
      name: '',
      email: '',
      caps: '',
      response: '',
      activeClass: 'active'
    }
  },
  methods: {
    submitForm() {
      axios.post('//jsonplaceholder.typicode.com/posts', {
        name: this.name,
        email: this.email,
        caps: this.caps
      }).then(response => {
        this.response = JSON.stringify(response, null, 2)
      })
    }
  }
})

Unfortunately, I do not currently have the opportunity to maintain a separate frontend and a separate backend.
I need it all to be one monolith for now (in fact, it’s not difficult for me to cut it, I laid it down when I created the code base)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
YourChief, 2011-03-22
@YourChief

I read the book of V.M. Ilyushechkin, who is my teacher in the disciplines of designing subd and subd oracle. In short, there are two approaches to design.
or you select several entities and their attributes and make a table for each. for example, a table of vendors with their last names, vendor shift number, etc., a table of products with their barcode, price, etc. and then establish links between them. you can draw everything in ERWin, and he himself implements the infological model for any specific DBMS in the form of creation requests and integrity conditions.
the second approach is more universal, it is called the decomposition method. is that when you design, you build a relation (table) containing all possible attributes. it is called the universal relation or first normal form. then you identify all functional dependencies between the attributes and decompose (separate into related tables) the relationship until it breaks down into several relationships that satisfy the normal form of the boy-codd. The advantage of the method is that it does not get hung up on the real meaning of rows and tables and always gives the best result. if you don’t find it on the Internet, I can try to find my own literature, where everything is written

A
AlexeyK, 2011-03-22
@AlexeyK

CREATE TABLE `variation` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`person_id` INT(11) unsigned NOT NULL DEFAULT '0',
`place_id` INT(11) unsigned NOT NULL DEFAULT '0',
`item_id` INT(10) unsigned NOT NULL default 0,
`date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`count` INT(11) unsigned NOT NULL default 0,
`summ` decimal(10, 2) UNSIGNED default 0.00,
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM;

the first thing that catches your eye, I added default / unsigned here and changed the summ type, after all, rubles and kopecks, besides, I would advise you to use InnoDB, you work with money after all and I think that data safety is important

S
slang, 2011-03-22
@slang

The normal classical structure, of course, lacks indexes on the fields for which there will be joins, but, as far as I understand, you yourself understand this very well ...

S
Stepan, 2011-03-23
@steff

Those. according to the database structure, everything is fine, right?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question