Hello. I decided to solve Demo task ExpressBoilerplate.#5
Hello. I decided to solve Demo task ExpressBoilerplate.#5vramaniuk wants to merge 8 commits intoaichholzer:masterfrom
Conversation
# Conflicts: # app/core/views/_components/html.pug
aichholzer
left a comment
There was a problem hiding this comment.
Thank you @vramaniuk -In general the work/code is good. Just a couple of questions from my side. Please shoot us a message on UpWork so we know who @vramaniuk (you) is on that platform.
| grunt.initConfig(tasks); | ||
| grunt.registerTask('build', ['cssmin', 'uglify']); | ||
| grunt.registerTask('watch', ['watch']); | ||
| grunt.loadNpmTasks('grunt-contrib-watch'); |
There was a problem hiding this comment.
No need to have this here, as it is already in the drop-in task.
There was a problem hiding this comment.
But without it here command 'grunt watch' doesn't work at me correctly.
And official documentation (https://github.com/gruntjs/grunt-contrib-watch) says
npm install grunt-contrib-watch --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-contrib-watch');
I'll better remove it from file /grunt/watch.task.js
There was a problem hiding this comment.
I meant this line: grunt.loadNpmTasks('grunt-contrib-watch'); which is already loaded in the drop-in task.
app/core/controllers/cities.js
Outdated
| }, | ||
|
|
||
| read: async (req, res) => { | ||
| read: async (req, res, next) => { |
There was a problem hiding this comment.
The logic in this method points to it being a DELETE. ;)
There was a problem hiding this comment.
This was my first solution for DELETE logic that I forgot to remove after using $.ajax.
So the form does not support the delete method, I implemented POST method with params, but it is not optimal.
Now I'm removing this solution.
| .exec(); | ||
| await user.remove(); | ||
| return res.status(200).end(); | ||
| return res.status(200) |
There was a problem hiding this comment.
Response for a DELETE method should be consistent throughout the API. In this case the response is not the same as for DELETE /users.
There was a problem hiding this comment.
I did not change anything significant here, the editor optimized the markup of the code
return res.status(200)
.end();
Only in app/core/controllers/users.js we are adding in request string 'success' , so now I'll add it here (in app/core/controllers/users.js).
app/core/views/_components/html.pug
Outdated
| meta(http-equiv='X-UA-Compatible', content='IE=Edge') | ||
| meta(content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no', name='viewport') | ||
| link(href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet') | ||
| link(href='/css/home.min.css', rel='stylesheet') |
There was a problem hiding this comment.
No need for this, the build logic generates a single .css.min file from /source/css/.
There was a problem hiding this comment.
I see.
Now only
link(href='/css/boilerplate.min.css', rel='stylesheet')
app/core/views/home/index.pug
Outdated
| .container | ||
| h3 Express boilerplate | ||
| p= message | ||
| p=message |
There was a problem hiding this comment.
Why was the space removed here?
There was a problem hiding this comment.
You are right. It was not necessary
app/core/views/_components/html.pug
Outdated
| body | ||
| block | ||
| script(src='https://code.jquery.com/jquery-3.3.1.min.js', integrity='sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=', crossorigin='anonymous') | ||
| script(src='/js/aj_logic.min.js', type='text/javascript') |
There was a problem hiding this comment.
This should be, by default, /js/boilerplate.min.js as that is what the build logic will output.
There was a problem hiding this comment.
OK
Now script(src='/js/boilerplate.min.js', type='text/javascript')
|
Hi Phillip, |
I created forms in their respective views (/app/core/views/) that allow you to create and delete users and cities.
Also for implementing delete logic (/app/core/controllers/[users.js,cities.js]) files have been changed.
Update cities logic implemented (/app/core/controllers/cities.js, /app/core/routes/cities.js )
Logger has been added in file (/app/index.js)
For DELETE and UPDATE logic "jQuery ajax" has been used.