Skip to content

Commit ff9b2cc

Browse files
committed
Set the expected path of the JSON source file.
1 parent e32ab25 commit ff9b2cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/Services/BookService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ public ICollection<Book> GetBooks()
3636
private ICollection<Book> LoadBooks()
3737
{
3838
// try and load from the book JSON data source (it will be readonly until we have a database backing the service).
39+
var path = Environment.GetEnvironmentVariable("HOME") + @"\site\wwwroot\books.json";
3940
var books = JsonSerializer
40-
.Deserialize<ICollection<Book>>(File.ReadAllText("books.json")) ?? new List<Book>();
41+
.Deserialize<ICollection<Book>>(File.ReadAllText(path)) ?? new List<Book>();
4142

4243
// save them to the cache for the next call to save on disk/azure storage operations.
4344
_cache.Set("books", books);

0 commit comments

Comments
 (0)