Closed bartoszherba closed 2 years ago
Hey, we should provide documentation for that functionality.
Yeah, @bartoszherba @filipsobol we're missing docs here.
@filipsobol Could you please double-check the documentation update?
Changelog note is missing as well.
❗ Making the createServer
async (return a Promise) is a breaking change that should not be a patch, but a minor release. ❗
Please also update the code sample in this section to reflect that createServer
is async, eg.:
(async () => {
const app = await createServer({ integrations });
app.listen(8181, () => {
console.log('Middleware started');
});
})();
Description
It solves ADR [#004] connection to API
The
onCreate
function should be called only once, when we start a middleware, then the app should use an instance of creating client for each incoming request - never create a new one. This is an experimental PR that confirms it: https://github.com/vuestorefront/commercetools/pull/190/files - please notice a change inindex.server.ts
- there is lifted up the state that holds the instance, only that change increases the capacity of our app rapidly.Types of changes
Checklist:
Changelog
Tests
Code standards
Docs