[GH-ISSUE #77] Restart server #26

Closed
opened 2026-05-23 08:38:53 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @srebling on GitHub (Mar 29, 2023).
Original GitHub issue: https://github.com/appy-one/acebase-server/issues/77

What is the proper way to programmatically stop and restart acebase-server? After running the code below, what commands are necessary to shutdown the server before running the same code again?

`

    const { AceBaseServer } = require('acebase-server');
    const dbname = 'Messages';
    
    const settings = {
        path: './',
        host: 'localhost',
        port: 5757,
        authentication: {
            enabled: false,
            allowUserSignup: false,
            defaultAccessRule: 'allow',
            defaultAdminPassword: '75sdDSFg37w5'
        }
    }
    
    const server = new AceBaseServer(dbname, settings);
    server.on("ready", () => {
        console.log("SERVER ready");
    });

`

Originally created by @srebling on GitHub (Mar 29, 2023). Original GitHub issue: https://github.com/appy-one/acebase-server/issues/77 What is the proper way to programmatically stop and restart acebase-server? After running the code below, what commands are necessary to shutdown the server before running the same code again? ` const { AceBaseServer } = require('acebase-server'); const dbname = 'Messages'; const settings = { path: './', host: 'localhost', port: 5757, authentication: { enabled: false, allowUserSignup: false, defaultAccessRule: 'allow', defaultAdminPassword: '75sdDSFg37w5' } } const server = new AceBaseServer(dbname, settings); server.on("ready", () => { console.log("SERVER ready"); }); `
Author
Owner

@appy-one commented on GitHub (May 8, 2023):

First of all, my apologies for this late reply!
Run server.shutdown()

From the JSDocs:

shutdown(): void
Shuts down the server. Stops listening for incoming connections, breaks current connections and closes the database. Is automatically executed when a "SIGINT" process event is received.

Once the shutdown procedure is completed, it emits a "shutdown" event on the server instance, "acebase-server-shutdown" event on the process, and sends an 'acebase-server-shutdown' IPC message if Node.js clustering is used. These events can be handled by cluster managing code to kill or exit the process safely.

Do you like AceBase? 👇🏼

Sponsor AceBase Spread the word contribute

<!-- gh-comment-id:1538473442 --> @appy-one commented on GitHub (May 8, 2023): First of all, my apologies for this late reply! Run `server.shutdown()` From the JSDocs: > shutdown(): void > Shuts down the server. Stops listening for incoming connections, breaks current connections and closes the database. Is automatically executed when a "SIGINT" process event is received. > > Once the shutdown procedure is completed, it emits a "shutdown" event on the server instance, "acebase-server-shutdown" event on the process, and sends an 'acebase-server-shutdown' IPC message if Node.js clustering is used. These events can be handled by cluster managing code to kill or exit the process safely. Do you like AceBase? 👇🏼 [![Sponsor AceBase](https://user-images.githubusercontent.com/26569719/168233053-8e56b243-4140-40ab-9a30-4cb3cc149bfe.svg)](https://github.com/sponsors/appy-one) [![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)
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#26
No description provided.