mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-01-22 07:06:28 +00:00
remove proxy
This commit is contained in:
parent
b22c3122d7
commit
808d846737
@ -1,12 +1,17 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite'
|
import { sveltekit } from '@sveltejs/kit/vite'
|
||||||
import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'
|
import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'
|
||||||
|
|
||||||
const port = 8001
|
const port = 3000
|
||||||
|
|
||||||
/** @type {import('vite').UserConfig} */
|
/** @type {import('vite').UserConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
server: { port },
|
server: {
|
||||||
|
port,
|
||||||
|
proxy: {
|
||||||
|
'/api': 'http://localhost:8000',
|
||||||
|
},
|
||||||
|
},
|
||||||
preview: { port },
|
preview: { port },
|
||||||
plugins: [sveltekit(), precompileIntl('locales')],
|
plugins: [sveltekit(), precompileIntl('locales')],
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"private": true,
|
|
||||||
"name": "@cryptgeon/proxy",
|
|
||||||
"type": "module",
|
|
||||||
"main": "./proxy.js",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "node ."
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"http-proxy": "^1.18.1"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
import http from 'http'
|
|
||||||
import httpProxy from 'http-proxy'
|
|
||||||
|
|
||||||
const proxy = httpProxy.createProxyServer()
|
|
||||||
proxy.on('error', function (err, req, res) {
|
|
||||||
console.error(err)
|
|
||||||
res.writeHead(500, { 'Content-Type': 'text/plain' })
|
|
||||||
res.end('500 Internal Server Error')
|
|
||||||
})
|
|
||||||
|
|
||||||
const server = http.createServer(function (req, res) {
|
|
||||||
const target = req.url.startsWith('/api/') ? 'http://127.0.0.1:8000' : 'http://localhost:8001'
|
|
||||||
proxy.web(req, res, { target, proxyTimeout: 250, timeout: 250 })
|
|
||||||
})
|
|
||||||
server.listen(3000)
|
|
||||||
console.log('Proxy on http://localhost:3000')
|
|
Loading…
Reference in New Issue
Block a user