Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tossr & routify with host option set doesn't work #18

Open
KararTY opened this issue Jan 17, 2022 · 0 comments
Open

tossr & routify with host option set doesn't work #18

KararTY opened this issue Jan 17, 2022 · 0 comments

Comments

@KararTY
Copy link

KararTY commented Jan 17, 2022

I'm getting this beautiful error

0|Aquamon  | [tossr] url: /aquarium/kararty
0|Aquamon  | Error: TypeError: Invalid URL: ramsreef.com/aquarium/kararty
0|Aquamon  |     at errorHandler (/var/www/html/fishimon-server/node_modules/tossr/tossr.js:22:15)
0|Aquamon  |     at /var/www/html/fishimon-server/node_modules/tossr/tossr.js:107:25
0|Aquamon  |     at new Promise (<anonymous>)
0|Aquamon  |     at tossr (/var/www/html/fishimon-server/node_modules/tossr/tossr.js:79:12)
0|Aquamon  | [tossr] Error on url: /aquarium/kararty
0|Aquamon  | [tossr] Unhandled promise rejection:
0|Aquamon  | [tossr] Error: TypeError: Invalid URL: ramsreef.com/aquarium/kararty
0|Aquamon  |     at errorHandler (/var/www/html/fishimon-server/node_modules/tossr/tossr.js:22:15)
0|Aquamon  |     at /var/www/html/fishimon-server/node_modules/tossr/tossr.js:107:25
0|Aquamon  |     at new Promise (<anonymous>)
0|Aquamon  |     at tossr (/var/www/html/fishimon-server/node_modules/tossr/tossr.js:79:12)

Page it should request: src/pages/aquarium/[username].svelte

My server is setup like this

import Router from '@koa/router'
import { tossr } from 'tossr'

const TEMPLATE = 'public/index.html'
const SCRIPT = 'public/build/main.js' // dist/build/main.js if you're using dynamic imports
const OPTIONS = {
  inlineDynamicImports: true,
  host: process.env.HOSTNAME,
}
const route = new Router()

route.get('(.*)', async (ctx) => {
  const html = await tossr(TEMPLATE, SCRIPT, ctx.request.url, OPTIONS)

  ctx.body = html
})

export default route
@KararTY KararTY changed the title tossr with Routify's param-is-page doesn't work. tossr with Routify's param-is-page gives error and doesn't load page Jan 17, 2022
@KararTY KararTY changed the title tossr with Routify's param-is-page gives error and doesn't load page tossr with host option set doesn't work Jan 17, 2022
@KararTY KararTY changed the title tossr with host option set doesn't work tossr & routify with host option set doesn't work Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant