Host Our Api
Add Pagination in Rest API
▶️ Railway
We are gonna use Railway for hosting our API. Railway is a free hosting platform for Node.js apps. It is very easy to use and has a very good documentation. You can host your API for free on Railway. You can also use other hosting platforms like Heroku, Vercel, etc.
- Visit Railway (opens in a new tab) and create an account.
- First login to your Railway account and click on the
New Project
button. - Click on new project
- Github Configuration
- Select Github and choose the repository you want to deploy.
- Select the branch you want to deploy.
- Click on
Deploy
button.
- It takes some time to deploy your app.
- GO to Variables and add your MongoDB URI and your API key.
- Give a Name
MONGODB_URL
and paste your MongoDB URI in the Value field. - Go to you mongodb ang go to
Network Access
and click onAdd IP Address
and add click onAllow Access from Anywhere
. - Go to settings and click on
Generate Domain
and copy the domain.