Horizon: Express server example with own website content

Created on 4 Aug 2016  Â·  12Comments  Â·  Source: rethinkdb/horizon

Server version: 1.1.3
Client version: 1.1.3

Node/Express server code:
`'use strict';

const PORT = 80;

const express = require('express');
const path = require('path');
const horizon = require('@horizon/server');

const app = express();
app.use(express.static(path.join(__dirname, '../dist')));

const http_server = app.listen(PORT);

var options = {auth: {token_secret: 'my_super_secret_secret'}};
const horizon_server = horizon(http_server, options);

console.log('Listening on port', PORT, 'Horizon', PORT );`

My problem is that once i try to add a static mapping for my website it just wont connect and throws this error:

polling-xhr.js:250 GET http://192.168.1.194/horizon/?EIO=3&transport=polling&t=LPLSRTG 400 (Bad Request)

Needs validation client

Most helpful comment

Beta will be out today come hell or high water!

On Tue, Aug 9, 2016, 11:35 Mihail Diordiev [email protected] wrote:

@deontologician https://github.com/deontologician, maybe publishing
2.0.0-alpha-1 to npm?

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/rethinkdb/horizon/issues/724#issuecomment-238648209,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAFVo_sw3DwBwQL2lhXWlYi5D4sYJ9_ks5qeMhXgaJpZM4JcoJ_
.

All 12 comments

This is very likely fixed in 2.0. We got rid of engine.io

Hello, any idea when 2.0 will be released? Or how i can use it already because i can see the code is already there.

@deontologician, maybe publishing 2.0.0-alpha-1 to npm?

Beta will be out today come hell or high water!

On Tue, Aug 9, 2016, 11:35 Mihail Diordiev [email protected] wrote:

@deontologician https://github.com/deontologician, maybe publishing
2.0.0-alpha-1 to npm?

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/rethinkdb/horizon/issues/724#issuecomment-238648209,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAFVo_sw3DwBwQL2lhXWlYi5D4sYJ9_ks5qeMhXgaJpZM4JcoJ_
.

NICE! cant wait haha, will test immediately and report back!

I see version 2.0.0 beta 3 now but it's not yet on npmjs?

it is on npm, just install horizon@beta

On Tue, Aug 9, 2016, 22:19 BenjaminFaal [email protected] wrote:

I see version 2.0.0 beta 3 now but it's not yet on npmjs?

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/rethinkdb/horizon/issues/724#issuecomment-238768402,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAFViJNUIidezEpKFS95_Wj-0tkvEWvks5qeV9sgaJpZM4JcoJ_
.

Hey i got it to work kind of, i just have this error now:

error: Connection to RethinkDB terminated: Error: The database horizon does not exist. Runhz schema applyto initialize the database, then start the Horizon server.

When i run hz schema apply it does not work and just prints all the required arguments but i dont know what to fill in to be honest.

@BenjaminFaal It expects a schema file name. Check http://horizon.io/docs/permissions/ for how to write a schema file.
If you instantiate the server with the auto_create_collection and auto_create_index options (only use these for development + testing), you can probably just pass an empty file to hz schema apply, since all the collections and indexes will be created later on first access.

So a couple questions:

  1. Are you migrating an app from 1.0, or making a new 2.0 app?
  2. are you embedding or using hz serve?

On Tue, Aug 9, 2016, 23:20 BenjaminFaal [email protected] wrote:

Hey i got it to work kind of, i just have this error now:

error: Connection to RethinkDB terminated: Error: The database horizon
does not exist. Runhz schema applyto initialize the database, then start
the Horizon server.

When i run hz schema apply it does not work and just prints all the
required arguments but i dont know what to fill in to be honest.

—
You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/rethinkdb/horizon/issues/724#issuecomment-238775840,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAFVu0EC4Sw9Fb7eQsszvi9LzBxJt0Iks5qeW2jgaJpZM4JcoJ_
.

@danielmewes Thanks i think i get it now!

@deontologician its a new 2.0 app and im embedding with the express server example

Thanks everyone, 2.0.0-beta-3 seems to fix the issue with websockets this issue can be closed now!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hnordt picture hnordt  Â·  7Comments

deontologician picture deontologician  Â·  7Comments

deontologician picture deontologician  Â·  3Comments

josephg picture josephg  Â·  6Comments

thinklinux picture thinklinux  Â·  5Comments