-1

I am building an Angular project for my company as a POC for utilizing Azure Notification Hub to send push notifications. The Microsoft Documentation instructs me to add the following code to server.js:

var azure = require('azure-sb');

However, I am building my app in TypeScript, not JavaScript, so I haven't created a server.js file. Is there a TypeScript (.ts) equivalent that I can create? Or can these types of operation only be done via JavaScript's server.js?

Drenai
  • 11,315
  • 9
  • 48
  • 82
Cade Bryant
  • 737
  • 2
  • 7
  • 19

1 Answers1

0

You have misunderstood or mistyped some things here.

Angular is a framework. It can be written with both javascript and typescript. Here is not angular your concern. Angular has nothing to do with server.js. Server.js is just used so that a server starts up based on your configurations. Nothing to do with angular.

Also server.js has nothing to do with Javascript or Typescript. It is just a file that is required from node.js which is an execution engine so that it can start a server which listens for requests.

Typescript always compiles to Javascript which then runs the project. Never typescript is used to execute an application. It always compiles to Javascript so that it can run.

So to your question

var azure = require('azure-sb');

That is javascript.

The equivalent in typescript would be

import { azure } from './azure-sb';

For more information about your last question check also here

relevant information from previous answer

Panagiotis Bougioukos
  • 15,955
  • 2
  • 30
  • 47