Skip to content

Hello. I decided to solve Demo task ExpressBoilerplate.#5

Open
vramaniuk wants to merge 8 commits intoaichholzer:masterfrom
vramaniuk:master
Open

Hello. I decided to solve Demo task ExpressBoilerplate.#5
vramaniuk wants to merge 8 commits intoaichholzer:masterfrom
vramaniuk:master

Conversation

@vramaniuk
Copy link

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.

Copy link
Owner

@aichholzer aichholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to have this here, as it is already in the drop-in task.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant this line: grunt.loadNpmTasks('grunt-contrib-watch'); which is already loaded in the drop-in task.

},

read: async (req, res) => {
read: async (req, res, next) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in this method points to it being a DELETE. ;)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Response for a DELETE method should be consistent throughout the API. In this case the response is not the same as for DELETE /users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

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')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this, the build logic generates a single .css.min file from /source/css/.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
Now only
link(href='/css/boilerplate.min.css', rel='stylesheet')

.container
h3 Express boilerplate
p= message
p=message
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was the space removed here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. It was not necessary

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')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be, by default, /js/boilerplate.min.js as that is what the build logic will output.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK
Now script(src='/js/boilerplate.min.js', type='text/javascript')

@vramaniuk
Copy link
Author

Hi Phillip,
would you like to proceed with the task questions?
Please reach out to us on Upwork (https://www.upwork.com/messages/rooms/room_60acac93964fde0b76c27e574e37ce95)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants