Open
Conversation
…controller method, httpexception handling
… - Commit 1 task 8
… - Commit 2 task 8
… - Commit 3 task 8
| const data = request.only(['title', 'content']) | ||
| const note = await Note.create(data) | ||
| const data = await request.validateUsing(NoteValidator) | ||
| await Note.create(data) |
There was a problem hiding this comment.
error handling? you should show proper error message on frontend aswell
| * Handle form submission for the create action | ||
| */ | ||
| async store({ request, response, logger }: HttpContext) { | ||
| logger.info("todo post getting called") |
There was a problem hiding this comment.
you should add validation in each controller function, where required.
| * Handle form submission for the edit action | ||
| */ | ||
| async update({ params, request, response, logger }: HttpContext) { | ||
| const todo = await Todo.findByOrFail('id', params.id); |
| let lon = request.input('lon') | ||
|
|
||
| if (!lat || !lon) { | ||
| const ipInfo = await axios.get('https://ipwho.is/') |
| lon = ipInfo.data.longitude | ||
| } | ||
|
|
||
| const weatherData = await WeatherService.getWeather(lat, lon) |
There was a problem hiding this comment.
what will happen this api throw an error or return 404 response?
780fe15 to
ecd4175
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.