npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsrmi

v1.1.2

Published

simple connector for javascript based applications

Downloads

2

Readme

JSRMI [JavaScript Remote Method Interface][Beta]

shields-npm-d shields-npm-l shields-npm-v

JavaScript Remote method interface helps to communicate between Server-side JS(NodeJs) and Client-side JS

Basic Idea

This is the world's first framework that helps to direct access to the server-side controller functions from the browser side (client-side) without having any troubles. And also it has a universal mechanism for cross communicate. Although currently, this framework supports only Nodejs. But we hope to release this technology to the JavaEE.

yYrnts1

Benefits

  • You know that when using the REST API, It needs to route every controller in every function manually. But with this framework that part is unnecessary. Because it handles automatically.
  • Creating AJAX Objects in client-side and calling the REST API is the traditional way to send AJAX requests. But there is nothing to do like that if you use this framework. Because that process is handled by itself.
  • It is possible to use Sessions, Multipart data and file uploading as a normal system.
  • As well as Http Request Objects and Response Objects can be used as normal.
  • No time-wasting.
  • In the feature, we hope to add end to end encryption and java implementation for this technology.

Release

Version 1.1.1

  • Mutipart support (https://github.com/gobzateloon/JSRMI/wiki/Multipart-(File-Uploading))
  • Minified version is updated

Version 1.0.3

  • First Beta Release

Installation

Server Side

First you have to add the JSRMI to your project

 npm i jsrmi

Then import it to your project

 const jsrmi = require('jsrmi');
 const path = require('path');

After that, you have to create a folder for controllers and configure it like this

app.set('controllers', path.join(__dirname, '/controllers'))

And now create a JS file on the controller path. This is a basic login example code of a controller

module.exports = function () {
 this.login = async function (Username, Password) {
 if (Username == "" || Username == undefined) throw "Invalid Username";
 if (Password == "" || Password == undefined) throw "Invalid Password";
 return (Username == "ABC" && Password == "123") ? "Login Success" : " Login Fail";
 }
}

Now we have to connect the JSRMI to the server.

jsrmi.route(app);

For example,here is a simple login structure that connected JSRMI.js client side JS on to that html. Nothing to worry client js is automatically hosted on "/jsrmi.js" path. all you have to do is add your views to the "/views" folder

app.use("/",express.static(__dirname + '/views'));

Sample Login

<div class="card mt-3">
 <div class="card-body">
 <h4 class="card-title">Login Form</h4>
 <p class="card-text">
 <div class="form-group">
 <label for="exampleInputEmail1">Email address</label>
 <input type="email" class="form-control" id="exampleInputEmail1"
 aria-describedby="emailHelp" placeholder="Enter email">
 <small id="emailHelp" class="form-text text-muted">We'll never share your email with
 anyone
 else.</small>
 </div>
 <div class="form-group">
 <label for="exampleInputPassword1">Password</label>
 <input type="password" class="form-control" id="exampleInputPassword1"
 placeholder="Password">
 </div>
 <input type="button" id="login_btn" class="btn btn-primary" value="Login" />
 </p>
 </div>
</div>

Client side

just create the remote object like this

<script src='/jsrmi.js'></script>
<script>
var test = new jsrmi("test_controller");
//var test = new jsrmi("your controler file name without .js");
</script>

That's all. now you can call any method of that controller. Also you can bring exception to the clinet side.

test.login(username, password).then((result) => {
 alert(result);
}).catch((error) => {
 $('#alert').show();
 $('#alert').html(error);
 setTimeout(() => {
 $('#alert').hide();
 }, 2000)
});

If you miss something or didn't work, then you can clone it from GitHub and run the test

Example projects

  • File Uploading https://github.com/gobzateloon/JSRMI_Example

Built With

  • Formidable - Handle multipart
  • Body Parser - Convert post data
  • ExpressJS - Http handling
  • NodeJS - Basic

License

This project is licensed under the MIT License - see the LICENSE file for details