campfinder's Issues
Create a catch-all path
Create a route that catches all invalid pathways. using app.all.
Note: app.all should be placed after all defined routes.
Validate campground data using JOI
Install and import JOI (https://joi.dev/)
Create a JOI schema in the post route for a new campground where campground is an object and required. Under the campground JOI object add your keys that are under campground. For each key define what type it is and whether it's required and/or any other parameters needed for each key.
Under the variable result, validate req.body against the campground schema and console.log(result)
- Try to get the error message returned with JOI to be displayed on the page
Adding random image to seed data
Using the unsplash API url : source.unsplash.com/collection/9046579, update the seedData so that the seed campsite generated are given a random image
Set up basic async error handling
Add very basic error handling for async errors that might occur with mongo
Use ExpressError class to throw an error if a route is not valid
The ExpressError should be thrown in the app.all route and using the next() middleware it should return a response from the last app.use. Destructure the error to return the variables defined in ExpressError class and return the status and message. You can give the status and message a default value when destructuring.
Add styling to show page
Define a ExpressError Class
Create a class called ExpressError that extends the Error class
Add styling to edit form
Add error handling to new form
If the campground input for the new form is empty, throw an ExpressError err (the work throw must be used because it is in an async function)
Add bootstrap validation to edit form
Add validation to the edit form using the bootstrap validation [https://getbootstrap.com/docs/5.0/forms/validation/]
Add styling to new form
Footer partial
Description
Add a footer partial in the same manner that the navbar was added where every page has access to the footer
Navbar partial
Description
Add a bootstrap navbar to main boilerplate that every page will have access to
Add validation middleware
Define and use middleware to validate inputs.
Move the validation into a middleware function set to a variable and add middleware to the routes that need it. The middleware should be called before the parameters of the route.
Add bootstrap form validation to new form
Add validation to the form to create a new campground using bootstrap form validation [https://getbootstrap.com/docs/5.0/forms/validation/]
Add error template
Create a new error.ejs view and adda bootstrap alert. In the app.use route, render and pass through the err variable to the error.ejs view. Also add a conditional to check if the error message is empty and then set the message to default value (err.message = "something something")
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.