[GH-ISSUE #49] Attach to an existing server #18

Closed
opened 2026-05-23 08:38:33 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @Azarattum on GitHub (Nov 23, 2022).
Original GitHub issue: https://github.com/appy-one/acebase-server/issues/49

Let's say we already have a node http server instance running. It would be nice to be able to attach acebase to that server and specify a route it will use. For example it might look like this:

import { AceBaseServer } from "acebase-server";
import { createServer } from "http";

const server = createServer();
server.listen(8080);

/* Our own server logic... */

new AceBaseServer("mydb", { server, prefix: "/acebase" });
// Attach acebase at http://localhost:8080/acebase

If there are workarounds currently that allow to attach AceBase to an existing server, please let me know. I know that there is a .app that lets you access the express app underneath, but in my use case the server is created before the AceBase is initialized, so I cannot use its http instance... Therefore, .extend also doesn't work for me...

One more thing is that new AceBaseServer automatically starts listening which is not ideal. I think it would make sense that if you pass the server param, the said server will control when it will start to listen (as well as its port).

Originally created by @Azarattum on GitHub (Nov 23, 2022). Original GitHub issue: https://github.com/appy-one/acebase-server/issues/49 Let's say we already have a node `http` server instance running. It would be nice to be able to attach `acebase` to that server and specify a route it will use. For example it might look like this: ```ts import { AceBaseServer } from "acebase-server"; import { createServer } from "http"; const server = createServer(); server.listen(8080); /* Our own server logic... */ new AceBaseServer("mydb", { server, prefix: "/acebase" }); // Attach acebase at http://localhost:8080/acebase ``` If there are workarounds currently that allow to attach `AceBase` to an existing server, please let me know. I know that there is a `.app` that lets you access the express app underneath, but in my use case the server is created **before** the AceBase is initialized, so I cannot use its `http` instance... Therefore, `.extend` also doesn't work for me... One more thing is that `new AceBaseServer` automatically starts listening which is not ideal. I think it would make sense that if you pass the `server` param, the said `server` will control when it will start to listen (as well as its port).
gitea-mirror 2026-05-23 08:38:33 -06:00
Author
Owner

@appy-one commented on GitHub (Nov 23, 2022):

Thanks @Azarattum, I'll take a look at implementing this. Feel free to drop a PR if you'd like to contribute!

<!-- gh-comment-id:1325648110 --> @appy-one commented on GitHub (Nov 23, 2022): Thanks @Azarattum, I'll take a look at implementing this. Feel free to drop a PR if you'd like to contribute!
Author
Owner

@Azarattum commented on GitHub (Nov 24, 2022):

@appy-one, take a look at https://github.com/appy-one/acebase-server/pull/55

<!-- gh-comment-id:1326186491 --> @Azarattum commented on GitHub (Nov 24, 2022): @appy-one, take a look at https://github.com/appy-one/acebase-server/pull/55
Author
Owner

@appy-one commented on GitHub (Dec 5, 2022):

Closed by merging #55, many thanks @Azarattum!

Spread the word contribute Sponsor AceBase

<!-- gh-comment-id:1338086993 --> @appy-one commented on GitHub (Dec 5, 2022): Closed by merging #55, many thanks @Azarattum! [![Spread the word](https://user-images.githubusercontent.com/26569719/169265089-3d593555-e1ad-4390-986b-877ac2c38a47.svg)](https://twitter.com/intent/tweet?button=&url=https://github.com/appy-one/acebase&text=I'm+using+@AcebaseRealtime+in+my+project+to+make+my+life+easier!&button=) [![contribute](https://user-images.githubusercontent.com/26569719/169265318-30c4c6a5-7c89-46a0-a7a2-ef433a8192f4.svg)](https://github.com/appy-one/acebase#contributing) [![Sponsor AceBase](https://user-images.githubusercontent.com/26569719/168233053-8e56b243-4140-40ab-9a30-4cb3cc149bfe.svg)](https://github.com/sponsors/appy-one)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase-server#18
No description provided.