Conversation
| doctype html | ||
| html(lang='en') | ||
| head | ||
| meta(charset='UTF-8') |
There was a problem hiding this comment.
These meta, link and script tags are now duplicated and will need to be updated in two places if anything changes. The reason for using a .pug mixin is to prevent exactly that. These should have been placed in the mixin so they can be used everywhere.
Most of these were already defined in the mixin: /ExpressBoilerplate/app/core/views/_components/html.pug
| +body() | ||
| doctype html | ||
| html(lang='en') | ||
| head |
| form.form-container#form | ||
| input(type='text', id='name', placeholder='Please enter name', name='name') | ||
| input(type='email', id='email' placeholder='Please enter name email', name='email') | ||
| input(type='text', id='city' placeholder='Please enter city', name='city') |
There was a problem hiding this comment.
The user model has a reference to cities. Cities, in this case, should have been a drop-down selector with available cities. The connecting reference would be the city id.
From the user model:
city: {
type: mongoose.Schema.Types.ObjectId,
ref: 'City',
default: null
}
| e.preventDefault(); | ||
| const validationFail = validation(); | ||
| if (!Object.keys(validationFail).length) { | ||
| $.post(`/cities/${name}`, $('#form').serialize()) |
There was a problem hiding this comment.
POST /cities does not use the request paramenter. In order to create a city the request body is used;
const city = await m.city.create(req.body);
And where is the user creation being handled?
| link(href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet') | ||
| link(href='/css/home.min.css', rel='stylesheet') | ||
| link(href='/css/form.min.css', rel='stylesheet') | ||
| script(src='https://code.jquery.com/jquery-3.3.1.min.js') |
There was a problem hiding this comment.
script tags should not be placed in the head, but rather in the body, at the end of the closing tag.
| @@ -0,0 +1,43 @@ | |||
| (function() { | |||

No description provided.