How to build your own API and Sell it
What is an API?
API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message or check the weather on your phone, you’re using an API.
Examples of API:
When you use an application on your mobile phone, the application connects to the Internet and sends data to a server. The server then retrieves that data, interprets it, performs the necessary actions and sends it back to your phone. The application then interprets that data and presents you with the information you wanted in a readable way. This is what an API is - all of this happens via API.
Steps:
1. Install node.js and express js on your computer
2. Create a new folder for the API
3. Open that folder in the code editor of your choice
4. Open the terminal in editor,
>> npm init -y (to create a package.json file)
5. Also install expressjs, request-promise, request, nodemon by
(in terminal) >> npm install express request request-promise nodemon
6. Now update the package.json file ,the script part,
"script": {
"dev": "nodemon index.js";
"start": "node index.js";
7. Now create a new javascript file named indes.js
8. In index.js file, we need to right api code
const express = request('express');
const request = request('request-promise');
const app = express();
const PORT = process.env.PORT || 5000;
app.use(express.json());
app.get('/' , (req, res) => {
res.send('welcome to my API');
/// write your request here
})
app.listen(PORT, () => console.log('server is running'));
7. Now we made bare-bones for our API
Watch this for further development here we use scraper API to scrape the data from the Amazon and use it in our API. And then you can sell your API to others in the RapidAPI platform
No comments
If you have any doubts, Please let me know