Prerequisites
- You should have a Cyclic.sh account. If you don't have one, sign up for an account on their website.
- Make sure you have Node.js and npm installed on your local machine.
- You should have an Express API project ready to deploy.
Step 1: Set up Your Express API
If you don't have an Express API project yet, create one with Node.js and Express:
mkdir my-express-api
cd my-express-api
npm init
npm install express Build your API by creating routes, controllers, and defining endpoints.
Step 2: Create a Cyclic.sh app
- Log in to your Cyclic.sh account.
- Click on "New App" and deploy a new app.
- On the 'Link Your Own' tab, search for your Express API. If you don't see it, try refreshing the list.
- Once you select the repo, a Github popup will appear asking you to install Cyclic and give it access to the repo.
Step 3: Set Up Deployment Configuration
- Specify the branch you want to deploy.
- Set up your deployment settings, including environment variables, if needed.
- Start the deployment process.
Step 4: Access Your Express API
After the deployment is complete, you can access your Express API through the provided URL. Test your API endpoints and ensure it's working correctly.
That's it! You've successfully hosted your Express API on Cyclic.sh for free. Cyclic.sh offers a free tier that allows you to run small projects at no cost. If you have more complex requirements or need additional resources, you can explore their pricing plans.