Scheduling App with Node JS - javascript

I was thinking about building a scheduling/time tabling app with Node JS that is primarily used in/as a mobile native app. Im certain I have worded the specifications wrong, but I was hoping for some guidance on where to start researching:
Any useful libraries/services
The general way to go about using Node JS for mobile
Anything you might think it useful
Thanks!

I am assuming you want to launch this mobile app natively on multiple platforms (IOS/Android/WP).
If that's the case, you can directly go for hybrid app frameworks which will help you write once and deploy natively on multiple devices. The best two hybrid frameworks that I found are React Native and Xamarin ( different people can have different opinions about different hybrid frameworks )
React Native will give you the opportunity to use JSX which is very close to Javascript. While in Xamarin you'll work purely in C#.
As far as your question regarding deploying natively via node.js is concerned, I don't think it's possible. If you read this blog post. It says the following.
Technically, you can run Node on Android, but not iOS. This is because Node uses Google’s V8 JavaScript engine. The V8 engine compiles JavaScript to a native code before executing it, a process known as Just-In-Time (JIT) compiling. iOS does not allow JIT compiling unless the device is jailbroken which why Node applications cannot be deployed native on iOS.
Obviously, any mobile strategy that ignores iOS is doomed to fail
So my suggestion would be to use one of these hybrid frameworks for front end and build a node.js based backend service where you can write a REST API to retrieve results for calls you make from the frontend.
There are tons of tutorials out there regarding how to build REST API's in node.js. this can be a good start.

Related

How to use observablehq/plot from .NET 5 app?

Our team intends to use JavaScript library observablehq/plot from an app written in C# and running on .NET 5. As a proof of concept, we were able to successfully use that library running in a separate process on Node.js. The downside of this approach is that we would need to implement all data serialization and inter-process communication ourselves, and we would need to bundle Node.js in our app installer. We are looking for an alternative approach that would not require Node.js, but instead would directly host V8 JavaScript engine in our .NET app. Currently, we are considering using ClearScript package for that. While we were able to successfully run simple JavaScript code using it, we discovered that observablehq/plot and its dependencies use some APIs that are present in Node.js, but are apparently unavailable in ClearScript out-of-the-box (it seems that Node.js implements some of those APIs in JavaScript, and some in C++). Making those implementations available to ClearScript running in .NET app looks like a significant task whose cost I cannot estimate at this point.
I would like to ask if anyone had to solve the same or similar problem, and what approach would you recommend? Is there an easy way to make all necessary APIs available to observablehq/plot running on ClearScript? Should I consider hosting Chromium/Edge browser engine in the .NET app instead? I haven’t yet tried this, but I assume it is possible because my understanding (correct me if I’m wrong) is that WebView2 control can be used in WPF apps running on .NET, and it is implemented using Chromium and V8 JavaScript engine. Is there any other approach you can recommend?
Update: The app GUI is built on Avalonia and SkiaSharp. It is possible that eventually we will choose another charting library, perhaps, one not written in JavaScript. But my task at hand is specifically to investigate whether and how we can use JavaScript libraries in our app, taking observablehq/plot as an example, and investigate its features and performance characteristics.
If you are building a WPF desktop app you should try a WPF based chart library that feats your needs.
Open source libraries:
OxyPlot
InteractiveDataDisplay
ScottPlot support pan and zoom.
Paid libraries:
Telerik RadChart
DevExpress
More info about WPF charts in this post.
If you are using Blazor WebAssembly:
Use jsRuntime and JSObjectReference to import and call your Javascript observablehp library.
If you are using Xamarin.Forms the best professional library out there is probably SyncFusion:
Syncfusion Charts
Update:
Avalonia Framework only will support this through a webview / embedded browser as you stated above. Here you have 3 options:
Cefnet is a .NET CLR binding for the Chromium Embedded Framework
CefGlue same than above
WebView Avaloria-CefGlue
For more usefull tools and libraries to use with Avalonia please refer to Awesome Avalonia.

Does an Android app written with JavaScript for front end and Java for back end count as native?

I'm really confused with what native means. I thought it referred to apps written completely in Java. I also heard that the top apps don't do hybrid development, they prefer native to stay advanced. However, I found that these guys use multiple languages for multiple different things. I'm new to coding and I have just finished learning JavaScript fundamentals and I am interested in developing Android apps. The native elitists have got me confused. Please guide me.
"Native code" is code that the hardware can run directly, without a software translation layer.
For example, to run a JavaScript application you need an interpreter, and to run a Java application you need a JVM. Neither of them are native. In comparison, applications developed in C and C++ languages typically are native.
Most android applications are written in Java, and therefore are not native code. To add native code to an Android application you need to use NDK: https://developer.android.com/ndk

Can electronjs be used for websites

I'm offered to build a project, a web application, or basically a website. But the client prefers that I use electronjs to develop it.
But as far as I know (Correct me if I'm wrong), electronjs is for building cross-platform desktop applications ONLY which can run on any OS like Windows, Linus, Mac, etc but not on a browser via URL. Since it uses HTML, CS, JS, or basically the browser's language, it may have confused my client to think that it can be used also for building web applications.
So my questions are:
Can I use electronjs for building a web application?
If yes, is it wise to use? Or building it in reactjs is better?
You are right. Electron was developed for building standalone desktop applications. It bundles a node.js server with a chromium browser to give the feeling of an application but of course uses web technology.
That said you can of course do a lot of things electron can by using a node.js server. But a lot of things - especially clientside file manipulation, or playing around with windows is than limited.
On the other hand you can build an electron application that accesses an online Server to retreive data or display webpages.
I would say no. Electron is used to build cross-platform desktop apps, and is not generally used to build websites. You could probably do it, but this is limited to very special circumstances, I would advise against it. You're probably better off using a framework meant to develop Single Web Apps, like React or Vue.
Like #Torf said with electron it's possible to have a nodejs application run in it's own chrome browser window (which looks like it's own application). But it's just a "website" which is displayed. So you can code a simple site and use it as website, windows application etc. it looks the same on all platforms.
What the hell then code-server does?
https://github.com/cdr/code-server
The fact that it is not yet generically implemented, does not mean "no".
Code-server is literally example of electron app that can be run inside a docker container, but have it's gui - as it is - rendered in a webpage.
Yes, not yet generically done, but is exactly possible.
No, it doesn't make sense to develop a website in ElectronJS. ElectronJS compiles and builds to formats that are not web-browser compatible. Like exe, zip, dmg, deb, etc.
You can develop a website in languages/frameworks which are designed for this purpose.

React Native + Android (Java) + iOS (Swift)

I am new to the world of Hybrid Application.
I have read in a lot of place that React Native fails to prove its computational power as compared to Native approaches.
Is it possible to write JavaScript code and when stuck, use the NATIVE CODE (JAVA AND SWIFT) in the same file to gain computational power.
I just want to know that JavaScript+ Android+ Swift programming can be written simultaneously in the same app to make use of every feature altogether? Maybe for convenience or better productivity
Short answer: No
Longer Answer: The closest thing React Native has to what you're talking about is implementing modules from native code, but you do that through JavaScript.
Quote from the Documentation on How to Implement Native UI Components:
There are tons of native UI widgets out there ready to be used in the
latest apps - some of them are part of the platform, others are
available as third-party libraries, and still more might be in use in
your very own portfolio. React Native has several of the most critical
platform components already wrapped, like ScrollView and TextInput,
but not all of them, and certainly not ones you might have written
yourself for a previous app. Fortunately, it's quite easy to wrap up
these existing components for seamless integration with your React
Native application.
Side Note: I have not used React Native before.
not in the same file, no, but in the same project. For some work, you will need to use third-party libraries (most of theme are writen with native langages), or create your own modules on android and ios and then use it for react native, those module will be writen on java for android and objective-c and swift ect for ios.
And for my little experience, react native is simple to use and you can build app very fast, mostly if you are used with javascript, but for my opinion, it's far from being a complete framework, it's not mature.

Is it possible to use my Swift libraries in React Native?

I have decided to swap development over for my mobile app side project from native swift to cross platform React native. The immediate road block that occurs to me when I try and begin doing this is wondering how to access all the libraries I was using in Swift via Cocoapods in react native. For example I am using a ton of Amazon Web Services Swift libraries and the Chameleon Swift color library. Is there a way to convert all these swift libraries/make them accesible in React Native or will I have to look for react native/javascript versions of all these libraries?
There are a lot of pre-built React Native components both written by the Facebook team and also the react native community. However, it seems from your question that you have some very specific native code that you will need to find a way to run in your future React Native application.
The best answer I can give to your question "which libraries should I use if any of them" with the information provided is "it depends".
I have built a few React Native mobile applications for both Android and iOS, and functionality that would have existed in Swift in these applications can be sometimes written in JavaScript - for instance, calling a web service using the fetch api that is built into React Native. If the AWS service you are calling accepts a basic HTTP request, then that could be something that you could write yourself in JavaScript.
If you are doing something more complex such as downloading a file from S3, you may need to use something like the community built react-native-fetch-blob, which has worked well for when I needed to download files. You would need to provide whatever SWS Auth tokens in the request header that are needed.
Another option is to write your own Native Module. These are chunks of application logic that you call from javascript in react native. They are very powerful as they allow you to do essentially anything you could have done before in a straight native app. They are written in the native platform language, so Obj-C for iOS, Java for Android, (but if you are feeling ambitious you could probably write them in Swift - I haven't tried). These native modules could then call out to the AWS Swift libraries that you have that already exist. My instinct says this may be the solution that would fit your needs best. The obvious downside to native modules is that they are native, so you would need to write one for each platform you support (iOS and Android, presumably).
There is also the option of simply incorporating React Native into your existing application. The idea being you can slowly either build out new components of your app in React Native or rewrite current logic into React Native in a piecemeal approach, taking smaller bites at a time so the whole task seems less daunting.
Finally, the Chameleon Swift appears to be a UI library. It doesn't seem like you would want to keep using this library if you went with React Native, as React Native is the "front-end" of a mobile application (amongst other things). HOWEVER, if you felt so desirous, you could write a native module that, in theory, could call the chameleon library to provide you with things like hex values for colors. I don't know if this would work well and would likely not be very performant, so I couldn't recommend you attempt to continue to use this library in a straight react-native app (but for sure if you used a hybrid app, see above!). React native has it's own cool tools, however, that you can use to make your app more awesome (here, here, here).
Phew, I hope this was useful.

Categories