Skip to content

Commit f545d76

Browse files
author
Jacek Jan Pietal
committed
feat: index redirect acts like spa returning 200 code
1 parent 678e2c7 commit f545d76

File tree

4 files changed

+341
-334
lines changed

4 files changed

+341
-334
lines changed

dist/server/static-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function createFileReader(folder = "") {
1515
const mime = (0, mime_types_1.lookup)(url) || "application/octet-stream";
1616
const filename = (0, path_1.join)(folder, url);
1717
if (!(0, fs_1.existsSync)(filename)) {
18-
return { mime: "text/html", body: index, status: 301 };
18+
return { mime: "text/html", body: index, status: 200 };
1919
}
2020
if ((0, fs_1.lstatSync)(filename).isDirectory()) {
2121
return fileReader(`${url}/index.html`);

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chef-core",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "chef-js core functionalities",
55
"main": "index.js",
66
"types": "./dist/index.d.ts",
@@ -37,8 +37,8 @@
3737
},
3838
"devDependencies": {
3939
"@types/mime-types": "^2.1.1",
40-
"@types/node": "^18.0.3",
41-
"jest": "^28.1.2",
40+
"@types/node": "^18.6.1",
41+
"jest": "^28.1.3",
4242
"prettier": "^2.7.1",
4343
"typescript": "^4.7.4"
4444
}

src/server/static-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function createFileReader(
1717
const filename: string = join(folder, url);
1818

1919
if (!existsSync(filename)) {
20-
return { mime: "text/html", body: index, status: 301 };
20+
return { mime: "text/html", body: index, status: 200 };
2121
}
2222

2323
if (lstatSync(filename).isDirectory()) {

0 commit comments

Comments
 (0)