Whether it can be shared publicly depends on how you write the code. If it is a project with separate front-end and back-end, just reuse the designed API. If it is the kind of code that is responsible for both the data layer and the presentation layer, you need to provide a pure data layer interface based on this set of code.
For example, you originally rendered the page like this // Pseudo code return res.render(view, data); Then you should now provide an interface with only data like // Pseudo code return data;
Don’t reinvent the wheel. If it can be reused, why not reuse it? Otherwise, the workload will be huge during update and maintenance. Even if the API interface cannot be reused, the original business logic can abstract some reusable underlying logic, so that only the new upper-level logic can be opened.
Whether it can be shared publicly depends on how you write the code. If it is a project with separate front-end and back-end, just reuse the designed API. If it is the kind of code that is responsible for both the data layer and the presentation layer, you need to provide a pure data layer interface based on this set of code.
For example, you originally rendered the page like this
// Pseudo code
return res.render(view, data);
Then you should now provide an interface with only data like
// Pseudo code
return data;
Don’t reinvent the wheel. If it can be reused, why not reuse it? Otherwise, the workload will be huge during update and maintenance.
Even if the API interface cannot be reused, the original business logic can abstract some reusable underlying logic, so that only the new upper-level logic can be opened.