Questions tagged [sveltekit-adapter-node]

10 questions
1
vote
0 answers

Adapter-node in sveltekit -- creating and using custom node server cors error

I had a project made in Sapper and attempting to recreate it in sveltekit. Unfortunately I'm unable to use my expressjs server code I have because I'm unable to get vite to start the app using my own custom expressjs server. I created a sveltekit…
Marco
  • 1,051
  • 19
  • 41
1
vote
0 answers

Sveltekit : custom express server causing not found errors during fetch

I'm trying to use sveltekit with a custom express server as outlined in the sveltekit doc here Here is my server : import { handler } from '../build/handler.js' import express from 'express'; const app = express(); app.use((req, res, next) => { …
Marco
  • 1,051
  • 19
  • 41
1
vote
0 answers

svelte kit serve files in a directory as static files

I need to serve some files in a directory as static files in the Svelte kit. these files are created in runtime (e.g. user uploaded files). Is there any Svelte kit built-in way to serve these files? or I should use external packages like…
seyed
  • 1,555
  • 1
  • 17
  • 24
1
vote
1 answer

How to deploy sveltekit application on non root path built using adapter-node?

I have created a Sveltekit application which I want to host at non root path like http://localhost:3000/dashboard My svelte.config.js is import adapter from '@sveltejs/adapter-node'; import preprocess from "svelte-preprocess"; /** @type…
Alok
  • 7,734
  • 8
  • 55
  • 100
0
votes
0 answers

Set specific headers for static files in SvelteKit

Background I need to serve some JS files from my SvelteKit project, with a URL of let's say https://foo.bar/public/.js. They are intended for use by other hosts, so I need permissive CORS headers. Placing those files in /static/public…
sam-w
  • 7,478
  • 1
  • 47
  • 77
0
votes
2 answers

sveltekit: how do I run startup/init code before anything else

The env: sveltekit 1.20.4 svelte 4.0.5 vite adapter-node How do I run startup code, before the server starts handling requests? I need to start multiple services before a single request is handled, and for it to happen when I start the server, not…
LAZ
  • 402
  • 4
  • 15
0
votes
1 answer

Get Dynamic Port of Sveltekit adapter-node Server

I have a Sveltekit app which must register itself through our backend by sending a request containing it's name and the port of the webserver. I'm trying to move this logic away from build-time file copying into hooks.server.ts, but am having…
kalkronline
  • 459
  • 2
  • 12
0
votes
0 answers

Hi, how can I know if the dom is loaded in Sveltekit with csr is set to false?

I am new to Sveltekit and I am trying to figure out how to handle SSR. I have a simple Sveltekit application with these configuration: export const csr = false; export const ssr = true; export const prerender = true; The main reason for this…
Rüzgar
  • 947
  • 9
  • 20
0
votes
0 answers

How to get a cookie in +page.js from a fetch reponse?

I'm learning sveltekit but struggling to get the value of a cookie from a response after use fetch to get the response. Here is my code which in the +page.svelte and +page.js in src/roots code: // +page.js let url = "api/getacookie" /** @type…
Marco
  • 1,051
  • 19
  • 41
0
votes
0 answers

Easier way to use both external module's CDN and packages in sveltekit?

In sveltekit I have my common js files that run on both client and server. This will reuse the same code on both the server and client side. This uses the moment.js module. (This is just an example where both CDN and npm exist. I actually use…
enoeht
  • 241
  • 2
  • 9