UNPKG

pepipost

Version:

Official nodejs library for sending email using web API v5

76 lines (43 loc) 3.31 kB
# Getting started with Pepipost API on windows Installing SDK on windows Server with Integrated Development Enviroment(IDE) These steps are dedicated to those who ❤️ to code on IDE. > Optional Note: This library will be sending HTTP calls to Pepipost server and hence if you're running any firewalls on your machine, then please whitelist the API base URL ```api.pepipost.com``` with ```port 443/80``` # Installation steps The generated SDK relies on [Node Package Manager](https://www.npmjs.com/) (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from [here](https://nodejs.org/en/download/). The SDK also requires Node to be installed. If Node isn't already installed, please install it from [here](https://nodejs.org/en/download/) > NPM is installed by default when Node is installed To check if node and npm have been successfully installed, write the following commands in command prompt: * `node --version` * `npm -version` ![Version Check](https://apidocs.io/illustration/nodejs?step=versionCheck&workspaceFolder=pepipost-Node) Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder): ```bash npm install ``` ![Resolve Dependencies](https://apidocs.io/illustration/nodejs?step=resolveDependency1&workspaceFolder=pepipost-Node) ![Resolve Dependencies](https://apidocs.io/illustration/nodejs?step=resolveDependency2) This will install all dependencies in the `node_modules` folder. Once dependencies are resolved, you will need to move the folder `PepipostLib ` in to your `node_modules` folder. ## How to Use The following section explains how to use the library in a new project. ### 1. Open Project Folder Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE. Click on `File` and select `Open Folder`. ![Open Folder](https://apidocs.io/illustration/nodejs?step=openFolder) Select the folder of your SDK and click on `Select Folder` to open it up in Sublime Text. The folder will become visible in the bar on the left. ![Open Project](https://apidocs.io/illustration/nodejs?step=openProject&workspaceFolder=pepipost-Node) ### 2. Creating a Test File Now right click on the folder name and select the `New File` option to create a new test file. Save it as `index.js` Now import the generated NodeJS library using the following lines of code: ```js var lib = require('lib'); ``` copy the [example.js](https://github.com/pepipost/pepipost-sdk-nodejs/blob/master/example.js) file and make neccessary changes. Save changes. ![Create new file](https://apidocs.io/illustration/nodejs?step=createNewFile&workspaceFolder=pepipost-Node) ![Save new file](https://apidocs.io/illustration/nodejs?step=saveNewFile&workspaceFolder=pepipost-Node) ### 3. Running The Test File To run the `index.js` file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file: ``` node index.js ``` ![Run file](https://apidocs.io/illustration/nodejs?step=runProject&workspaceFolder=pepipost-Node)