then we want to create a schema so we're gonna call this URL schema and we set this to a new Mongoose dot schema and then this takes in an object with all the fields we want so the first thing is a URL code and that's gonna be string we also want a long URL so that's you know the long version or the original URL and then a short URL which we're going to construct which will also be a string and then let's also have the date for the date I'm gonna set type string the reason I'm doing it this way is because I also want to do a default and let's make that date dot now that way that the current date and time will be inserted and then we just want a module dot exports so we want to export the model so we say Mongoose dot model and name of the model is URL and then we need to pass in the schema okay and that's it let's save that so that's our model now we need to start to deal with our routes so we're gonna have a folder called routes basically just gonna have two routes but I'm gonna have two separate files one is gonna be index dot JSON is gonna be whether that's use me URL dot J s so URL j s is basically where we're gonna have our post route to be able to create a URL and insert it into the database index J s is gonna have the basically all the short URLs recreate we need to have them work so basically we need to have them redirect to the long URLs that's what's going to go in here so before we do anything here let's go to our main index J s and we need to basically define our routes so let's go right here and say app dot use so we just want to set slash to require dot slash routes slash index I'll copy that down and then we also want slash API slash URL to pertain to that URL routes file alright so we'll save that what's this okay so it's just telling us we haven't used a router yet so we need to go to both of these and set up our Express router so the way we do that is we bring in Express
NO_SEGMENT_TOKEN