-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get new example working during build
- Loading branch information
1 parent
00dda8e
commit 5370bba
Showing
4 changed files
with
21 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Returns the file body for this non-HTML file. | ||
// The content type is based off of the extension in the filename, | ||
// in this case: about.json. | ||
export async function get() { | ||
return { | ||
body: JSON.stringify({ | ||
name: 'Astro', | ||
url: 'https://astro.build/', | ||
}), | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
--- | ||
const url = `${Astro.request.canonicalURL.origin}/company.json`; | ||
const response = await fetch(url); | ||
const data = await response.json(); | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
<h1>Astro</h1> | ||
<div>{JSON.stringify(data)}</div> | ||
<h1 id="result">Loading...</h1> | ||
<script type="module"> | ||
// Non-HTML files will be included in your final build, so you | ||
// can fetch them directly in the browser. | ||
const response = await fetch(`/about.json`); | ||
const data = await response.json(); | ||
document.getElementById('result').innerHTML = `Load complete!<br/>Built with: <a href="${data.url}">${data.name}!</a>`; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
</script> | ||
</body> | ||
</html> |
🥇