Skip to content

Commit 9c43daa

Browse files
authored
feat(hooks): document secured api keys (#394)
* feat(hooks): document secured api keys copied from the react-instantsearch example * fix boog
1 parent 4af14ef commit 9c43daa

File tree

18 files changed

+9322
-30
lines changed

18 files changed

+9322
-30
lines changed

InstantSearch.js/secured-api-keys/server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ app.get('/', async (_, res) => {
3939
res.send(indexWithServerData);
4040
});
4141

42-
app.listen(8080);
42+
const PORT = 8080;
43+
44+
app.listen(PORT, () =>
45+
console.log(`Example app listening at http://localhost:${PORT}`)
46+
);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"proseWrap": "never",
4+
"trailingComma": "es5"
5+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# secured-api-keys
2+
3+
_This project was generated with [create-instantsearch-app](https://github.com/algolia/create-instantsearch-app) by [Algolia](https://algolia.com)._
4+
5+
## Get started
6+
7+
To run this project locally, install the dependencies and run the local server:
8+
9+
```sh
10+
npm install
11+
npm run server
12+
```
13+
14+
Alternatively, you may use [Yarn](https://http://yarnpkg.com/):
15+
16+
```sh
17+
yarn
18+
yarn server
19+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "secured-api-keys",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"start": "react-scripts start",
7+
"build": "react-scripts build",
8+
"server": "npm run build && node server.js",
9+
"lint": "eslint .",
10+
"lint:fix": "npm run lint -- --fix"
11+
},
12+
"dependencies": {
13+
"algoliasearch": "4.13.1",
14+
"express": "4.18.1",
15+
"react": "18.2.0",
16+
"react-dom": "18.2.0",
17+
"react-instantsearch-hooks-web": "6.29.0",
18+
"react-scripts": "5.0.1"
19+
},
20+
"browserslist": {
21+
"production": [
22+
">0.2%",
23+
"not dead",
24+
"not op_mini all"
25+
],
26+
"development": [
27+
"last 1 chrome version",
28+
"last 1 firefox version",
29+
"last 1 safari version"
30+
]
31+
}
32+
}
1.88 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="theme-color" content="#000000">
8+
9+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
10+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.png">
11+
12+
<!--
13+
Do not use @7 in production, use a complete version like x.x.x, see website for latest version:
14+
https://community.algolia.com/react-instantsearch/Getting_started.html#load-the-algolia-theme
15+
-->
16+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@7/themes/algolia-min.css">
17+
18+
<title>secured-api-keys</title>
19+
</head>
20+
21+
<body>
22+
<noscript>
23+
You need to enable JavaScript to run this app.
24+
</noscript>
25+
26+
<div id="root"></div>
27+
28+
<script>
29+
window.SERVER_DATA = __SERVER_DATA__;
30+
</script>
31+
</body>
32+
33+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "secured-api-keys",
3+
"name": "secured-api-keys Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.png",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": "./index.html",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"template": "node",
3+
"container": { "port": 8080, "startScript": "server" }
4+
}

0 commit comments

Comments
 (0)