Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ let server = new FastBootAppServer({
gzip: true, // Optional - Enables gzip compression.
host: '0.0.0.0', // Optional - Sets the host the server listens on.
port: 4000, // Optional - Sets the port the server listens on (defaults to the PORT env var or 3000).
sandboxGlobals: { GLOBAL_VALUE: MY_GLOBAL }, // Optional - Make values available to the Ember app running in the FastBoot server, e.g. "MY_GLOBAL" will be available as "GLOBAL_VALUE"
buildSandboxGlobals(defaultGlobals) { // Optional - Make values available to the Ember app running in the FastBoot server, e.g. "MY_GLOBAL" will be available as "GLOBAL_VALUE"
return Object.assign({}, defaultGlobals, { GLOBAL_VALUE: MY_GLOBAL });
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This aligns with changes introduced in fastboot package.

chunkedResponse: true // Optional - Opt-in to chunked transfer encoding, transferring the head, body and potential shoeboxes in separate chunks. Chunked transfer encoding should have a positive effect in particular when the app transfers a lot of data in the shoebox.
});

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"chalk": "^2.0.1",
"compression": "^1.6.2",
"express": "^4.13.3",
"fastboot": "^2.0.0",
"fastboot-express-middleware": "^2.0.0"
"fastboot": "^3.1.1",
"fastboot-express-middleware": "^3.0.0"
},
"devDependencies": {
"chai": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/fastboot-app-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FastBootAppServer {
this.httpServer = options.httpServer;
this.beforeMiddleware = options.beforeMiddleware;
this.afterMiddleware = options.afterMiddleware;
this.sandboxGlobals = options.sandboxGlobals;
this.buildSandboxGlobals = options.buildSandboxGlobals;
this.chunkedResponse = options.chunkedResponse;

if (!this.ui) {
Expand All @@ -46,7 +46,7 @@ class FastBootAppServer {
httpServer: this.httpServer,
beforeMiddleware: this.beforeMiddleware,
afterMiddleware: this.afterMiddleware,
sandboxGlobals: this.sandboxGlobals,
buildSandboxGlobals: this.buildSandboxGlobals,
chunkedResponse: this.chunkedResponse,
});

Expand Down
6 changes: 3 additions & 3 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Worker {
this.password = options.password;
this.beforeMiddleware = options.beforeMiddleware;
this.afterMiddleware = options.afterMiddleware;
this.sandboxGlobals = options.sandboxGlobals;
this.buildSandboxGlobals = options.buildSandboxGlobals;
this.chunkedResponse = options.chunkedResponse;

if (!this.httpServer) {
Expand All @@ -32,7 +32,7 @@ class Worker {
password: this.password,
beforeMiddleware: this.beforeMiddleware,
afterMiddleware: this.afterMiddleware,
sandboxGlobals: options.sandboxGlobals,
buildSandboxGlobals: options.buildSandboxGlobals,
});
}

Expand Down Expand Up @@ -74,7 +74,7 @@ class Worker {
buildMiddleware() {
this.fastboot = new FastBoot({
distPath: this.distPath,
sandboxGlobals: this.sandboxGlobals,
buildSandboxGlobals: this.buildSandboxGlobals,
});

return fastbootMiddleware({
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/dist-path-change-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const connector = new DownloaderNotifier({
var server = new FastBootAppServer({
notifier: connector,
downloader: connector,
sandboxGlobals: { THE_GLOBAL: MY_GLOBAL }
buildSandboxGlobals(defaultGlobals) {
return Object.assign({}, defaultGlobals, { THE_GLOBAL: MY_GLOBAL });
}
});

const serverPromise = server.start();
Expand Down
4 changes: 3 additions & 1 deletion test/fixtures/sandbox-globals-app-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const MY_GLOBAL = 'MY GLOBAL';

var server = new FastBootAppServer({
distPath: path.resolve(__dirname, './global-app'),
sandboxGlobals: { THE_GLOBAL: MY_GLOBAL }
buildSandboxGlobals(defaultGlobals) {
return Object.assign({}, defaultGlobals, { THE_GLOBAL: MY_GLOBAL });
}
});

server.start();
Loading