MmM
MmM

Reputation: 3581

Change port for Fresh (Deno) webserver

My server keeps listening to port 8000, even after I’ve modified the main.tsx to include:

await start(manifest, { port: 3000 });

Upvotes: 2

Views: 2140

Answers (2)

Kipnoedels
Kipnoedels

Reputation: 1385

The previous answer is outdated. Currently the port is set using fresh.config.ts:

import { defineConfig } from '$fresh/server.ts';

export default defineConfig({
    server: {
        port: 3000,
    },
});

Upvotes: 1

jps
jps

Reputation: 22535

I guess you have added that line after the existing

await start(manifest, { render });

Then it doesn't work. Instead modify the existing line to

await start(manifest, { render, port: 3000 });

I did it after the server was started with

deno task start

and got

Watcher File change detected! Restarting!
Server listening on http://localhost:3000

Upvotes: 4

Related Questions