0

Alfresco uses Rhino JavaScript as server-side scripts implementation with special Alfresco's Root Objects and specific method to import other scripts <import resource="/Company Home/Data Dictionary/Scripts/myscript.js">.

I have already configured Visual Studio Code and NodeJS with mocked all root objects, so I can test and debug some emulated cases... but this is definitely not enough.

I've found:

What is recommended by Alfresco developers method to develop server-side JavaScript?

4
  • What isn't working for you with your current development method? What problems are you hitting? Errors? Issues? etc Commented Oct 8, 2016 at 20:54
  • my problems for example: differences between NodeJS and Rhino JavaScript (e.g. no prototyping), poor root objects mocking,... Commented Oct 8, 2016 at 22:59
  • Are you trying to unit test your code? Or something else? Commented Oct 9, 2016 at 9:09
  • yes, I have some unit tests using on my mocked root objects Commented Oct 9, 2016 at 9:12

1 Answer 1

2

I use the tools you referenced. I write my Alfresco server-side JavaScript either in the JS console or in Atom, depending on what I'm doing.

If you have a need for anything beyond that you may want to reconsider using JavaScript and instead use Java, Alfresco's native language and foundational API.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Jeff, this is also my conclusions, I would just like somebody to confirm. JavaScript should be used for short scripts only. More complex tasks should be implemented as custom java beans, sometimes exposed as JavaScript root objects... Is that a right way?
Yes, that is my approach. People are free to make their server-side JavaScript as lengthy or complex as they want, obviously, but in my opinion it becomes unwieldy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.