I have a ASP.NET Core 5 web API app which works fine and can get and post data with Postman, but when I am trying to access it with my Next.js app I get 500 failed, reason: unable to verify the first certificate.
When I try to get fake data from https://jsonplaceholder.typicode.com/users
it works without any problem.
Do I need especial permission on IIS express?
I'm new to this.
Here is my code for Next.js:
const myHeaders = new Headers();
myHeaders.append("Content-Type","application/json");
const requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect:'follow'
};
var raw = JSON.stringify({
"title": "titanic",
"releaseDate": "1998-10-05",
"genre": "romance",
"price": 11.99
})
export const getStaticProps = async () => {
const res = await fetch(`https://localhost:44310/api/movies`)
const data = await res.json()
return {
props: {movies:data}
}
}
const Movies = ({movies}) => {
return (
<div>
<h1>movies</h1>
{movies.map(m => (
<div key={m.id}>
<a>
<h4>{m.title}</h4>
</a>
</div>
))}
</div>
);
}
export default Movies;