Skip to content

Commit 6e3c28d

Browse files
committed
netlify redirect
1 parent e543616 commit 6e3c28d

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

devops/copy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import shell from 'shelljs'
22

33
shell.rm('-Rf', 'prod')
44
shell.mkdir('prod')
5-
shell.cp('-R', '.svelte-kit', 'prod/svelte-kit')
5+
shell.cp('-R', '.svelte-kit', 'prod/.svelte-kit')
66
shell.cp('-R', 'package.json', 'prod/package.json')
7+
shell.cp('-R', 'build', 'prod/build')
78
shell.cp('-R', 'static', 'prod/static')

netlify.toml

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
command = "npm run build"
33
publish = "build/"
44
functions = "functions/"
5+
6+
[[redirects]]
7+
from = "/api"
8+
to = "https://api.litekart.in"
9+
status = 200
10+
force = true # COMMENT: ensure that we always redirect

svelte.config.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ const config = {
1818
vite: {
1919
server: {
2020
proxy: {
21-
'/api': 'https://api.litekart.in',
21+
'/api': {
22+
target: 'https://api.litekart.in',
23+
changeOrigin: true,
24+
rewrite: (path) => path.replace(/^\/api/, ''),
25+
},
26+
// '/api': 'https://api.litekart.in/api',
2227
},
2328
},
2429
ssr: {

0 commit comments

Comments
 (0)