-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1209 from o1-labs/docs/readme-dev-update
Readme and repo grooming, release 0.14
- Loading branch information
Showing
7 changed files
with
82 additions
and
17 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Submodule bindings
updated
from 03cc35 to a7f73e
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,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>hello-snarkyjs</title> | ||
<script type="importmap"> | ||
{ "imports": { "snarkyjs": "./index.js" } } | ||
</script> | ||
<script type="module" src="./simple_zkapp.js"> | ||
</script> | ||
</head> | ||
<body> | ||
<div>Check out the console (F12)</div> | ||
</body> | ||
</html> |
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,42 @@ | ||
import fs from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import http from 'node:http'; | ||
|
||
const port = 8000; | ||
const defaultHeaders = { | ||
'content-type': 'text/html', | ||
'Cross-Origin-Embedder-Policy': 'require-corp', | ||
'Cross-Origin-Opener-Policy': 'same-origin', | ||
}; | ||
|
||
const server = http.createServer(async (req, res) => { | ||
let file = '.' + req.url; | ||
console.log(file); | ||
|
||
if (file === './') file = './index.html'; | ||
let content; | ||
try { | ||
content = await fs.readFile(path.resolve('./dist/web', file), 'utf8'); | ||
} catch (err) { | ||
res.writeHead(404, defaultHeaders); | ||
res.write('<html><body>404</body><html>'); | ||
res.end(); | ||
return; | ||
} | ||
|
||
const extension = path.basename(file).split('.').pop(); | ||
const contentType = { | ||
html: 'text/html', | ||
js: 'application/javascript', | ||
map: 'application/json', | ||
}[extension]; | ||
const headers = { ...defaultHeaders, 'content-type': contentType }; | ||
|
||
res.writeHead(200, headers); | ||
res.write(content); | ||
res.end(); | ||
}); | ||
|
||
server.listen(port, () => { | ||
console.log(`Server is running on: http://localhost:${port}`); | ||
}); |