Bing Search API with NodeJS

Bing provides a search API by which you can use the power of bing search in your own application. The base URL for the search API is:

https://api.cognitive.microsoft.com/bing/v7.0/search

The code to integrate the API using Express and Node JS is:




var express = require('express'); var path = require('path'); var app = express(); var request = require('request'); // The main search function var bing_web_search = function (search, callback) { console.log('Searching the Web for: ' + search); var options = { method: 'GET', url: 'https://api.cognitive.microsoft.com/bing/v7.0/search', qs: { q: search }, headers: { 'ocp-apim-subscription-key': '<YOUR_SUBSCRIPTION_API_KEY>' } }; request(options, function (error, response, body) { callback(error, body); }); }; app.get('/', function (req, res) { bing_web_search('<YOUR_SEARCH_QUERY>', function(error, body) { if (!error) { res.send(body); } else { throw new Error(error); } }); }); app.listen(3000, function () { console.log('Example app listening on port 3000!'); });
Code language: JavaScript (javascript)

The API Subscription Key can be created at the website:

https://azure.microsoft.com/en-in/services/cognitive-services/bing-web-search-api/

If you want more results, then you can use pagination by adding two query params:
1. count: specifies the number of results to return in the response
2. offset: specifies the number of results to skip

Recent Post

  • State Management with Currying in React.js

    Dive into React.js state management made easy with currying. Say goodbye to repetitive code and hello to streamlined development. Explore the simplicity and efficiency of currying for your React components today!

  • How Much Does It Cost to Develop an App in 2024?

    The price of bringing your app to life typically ranges from $20,000 to $200,000. This cost varies based on factors like which platform you choose, the complexity of features you want, and the size of your intended audience. However, costs can climb even higher for more complex projects, reaching up to $350,000.

  • Mastering Software Testing Strategies: Your Guide

    Implementing best software testing strategies is a crucial part of software development, ensuring that digital products meet industry standards. Defined by the International Software Testing Qualification Board, it encompasses a range of activities, both static and dynamic, throughout the software’s lifecycle. As an essential component of the Software Development Life Cycle (SDLC), the Software Testing […]

  • Your Complete Guide to Securing Your Kubernetes Cluster: Essential Tips for Beginners

    In today’s digital landscape, Kubernetes has emerged as the go-to solution for managing applications at scale. However, amidst its power lies a crucial concern: security. Ensuring the safety of your Kubernetes cluster is paramount to protecting your applications, data, and infrastructure. This comprehensive guide will walk you through essential practices and tips to help you […]

  • How to use Cloudinary in Node.js to upload images?

    It’s simple to use Cloudinary to upload images in a Nodе.js application, which can improve your app’s imagе management capabilities. Wе’ll go over how to sеt up and incorporate Cloudinary in your Nodе.js application for imagе uploads and how to use Cloudinary nodejs in this blog article. What is Cloudinary? Cloudinary is a cloud-based media […]

  • Mobile App User Experience- 10 Biggest Mistakes First-Time Founders Make 

    With the mobile app industry hitting a whopping 206 Billion in value (as per Grand View Research), it is no wonder more entrepreneurs are jumping into the mobile app market with their innovative ideas and life-changing solutions. But for those taking their first plunge, it is crucial to understand that creating an app isn’t just […]