File here, so the base URL is localhost:3000/.
So as you recognized, this is nothing but the URL of the JSON
server that we have already started in one of the previous exercises.
In addition, we're going to create here few new files,
where we will create a JavaScript interface here.
So the first file that I'm going to create is called comment.ts.
And within the comment.ts,
I'm going to Create a TypeScript
interface called Comment.
And if you have taken the Angular course,
you would have seen that I have used class for the comment.
Now, here I am demonstrating the use of a JavaScript or
TypeScript interface inside of a class here.
So this interface contains rating, which is a number.
And comment, which is a string.
Then author, And
date, which is also a string here.
So this is the interface that I'm going to export from that comment.ts file.
The use of interface in TypeScript is one of the core principles where
type checking focuses on the shape that values have.
So previously, we have seen the use of the standard primitive types,
like the number string, and other types that we use.
And also the use of any in TypeScript.
Interface helps us to define a structure, or
what we call as duck typing in TypeScript, or
structural subtyping in TypeScript.
So the interface allows us to define a structure,
which defines a newly defined type that we can use to attribute
to specific variables that we use within our TypeScript code here.
So that is the use of a comment here.
Now, class, of course, has both the instance
variables, and also the methods here.
Now in this case, I'm not going to have any methods.
So instead,
I'm just going to use an interface instead of defining an entire class.
Now, if you are more comfortable using classes,
then what we have done in the previous course with Angular,
where we defined the same thing as a class, is just as acceptable.
Next, I am going to define another file called dish.ts.
And inside here, we will define a interface called Dish.
So here, we will first import the Comment from,