Friday, October 24, 2025

Meteor Core API

Meteor is a full-stack JavaScript platform that is used for developing modern web and mobile applications. Meteor has a set of features that are helpful in creating a responsive and reactive web or mobile application using JavaScript or different packages available in the framework. It is used to build connected-client reactive applications.

You can use Meteor.isClient to limit the code to only run on the client-side and Meteor.isServer to limit the code to only run on the server-side. Anything outside of .isClient and .isServer is gonna run on both.

Syntax:

if (Meteor.isClient) {
   // The code is now running on the client...
}

if (Meteor.isServer) {
   // The code is now running on the server....
}

 

Creating Meteor Application and Importing Module:

Step 1: Create a Meteor application using the following command.

meteor create foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command.

cd foldername

Step 3: Import Meteor module from ‘meteor/meteor’

import { Meteor } from 'meteor/meteor'

Project Structure: It will look like the following.

Step to Run Application: Run the application from the root directory of the project using the following command.

meteor

Example: It is the basic example that shows how to use the Core API component.

Main.html




<head>
    <title>gfg</title>
</head>
  
<body>
    <h1 class="heading">neveropen</h1>
  
    {{> hello}}
    <!-- {{> info}} -->
</body>
  
<template name="hello">
    <p>
      You can use Meteor.isClient to limit 
      the code to only run on the client-side 
      and Meteor.isServer to limit the code to 
      only run on the server-side. 
    </p>
</template>


Main.js




import { Template } from 'meteor/templating';
import './main.html';
  
Template.hello.onCreated(function helloOnCreated() {
    if (Meteor.isClient) {
        // The code is now running on the client...
        console.log("Meteor is running in the client?, ",
            Meteor.isClient);
        console.log("Meteor is running in the server?, ",
            Meteor.isServer);
    }
  
    if (Meteor.isServer) {
        // The code is now running on the server....
        console.log("Meteor is running in the client?, ",
            Meteor.isClient);
        console.log("Meteor is running in the server?, ",
            Meteor.isServer);
    }
});


Output:

Reference: https://docs.meteor.com/api/core.html

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS