Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9248951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:04:33+00:00 2026-06-18T10:04:33+00:00

In a project I m working on now I have some web models to

  • 0

In a project I m working on now I have some web models to represent form submission etc. For instance the login form (a pretty bad example) is as follows:

var revalidator = require('revalidator'); // A node.js module for validation

LoginForm = function(email, password) {
    this.Email = email;
    this.Password = password;
};

LoginForm.prototype.validate = function() {
  return revalidator.validate(this, {
    properties: {
        Email: {
          description: 'The email address provided is not valid',
          type: 'string',
          format: 'email',
          required: true
        },
        Password: {
          description: 'The password is not provided',
          type: 'string',
          required: true
        }
      }
  })
};

exports.LoginForm = LoginForm;

This works great currently in my current node.js setup, but I was wondering if there is any way I can reuse those models on the client-side javascript code. Any help would be really appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:04:34+00:00Added an answer on June 18, 2026 at 10:04 am

    Javascript is Javascript, you can share the code. You have to keep in mind that there are some differences between browsers and Node. If you want to share you code you must not use require and have to check if the export object exists before using it:

    if(typeof exports === 'object'){
        exports.LoginForm = LoginForm;
    } else {
        // your browser export
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web flow project I been working on and now its time
In the project I'm working on now, we have base Entity class that looks
I am working on a WPF MVVM Project. Now i have a DataGrid in
So I have been working on this project for a short while now. I
I need to have an at-home project now that I'm working on Python/Django at
I'm working on a multi-project, and right now I have a structure that resembles
Right now, I am working on a web project in PHP and for the
I have been writing a web app for some time now for Google App
I'm working with Silverlight. In it, I've created a web project. I always have
I've been working for a few weeks now with some web tecnologies, but i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.