https://github.com/bhacaz/vercel-functions-ruby-test
Test Vercel Ruby serverless functions
https://github.com/bhacaz/vercel-functions-ruby-test
ruby vercel vercel-serverless
Last synced: 2 months ago
JSON representation
Test Vercel Ruby serverless functions
- Host: GitHub
- URL: https://github.com/bhacaz/vercel-functions-ruby-test
- Owner: Bhacaz
- Created: 2021-10-29T19:06:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T19:47:42.000Z (over 4 years ago)
- Last Synced: 2025-11-17T14:03:29.407Z (7 months ago)
- Topics: ruby, vercel, vercel-serverless
- Language: Ruby
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vercel-functions-ruby-test
Ruby Serverless functions are still in Alpha at Vercel and we can't test it locally
with the Vercel-CLI.
This repo provide a script and examples to test locally your serverless functions.
No need to modify this script. The script will explore the `api` folder to create each `.rb` file a GET and POST endpoint.
## Installation
1. Copy the `server.rb` file into your root directory of your project.
2. Run `ruby server.rb`
3. Test your function to `http://localhost:8000/api/{{function-name}}`
## Examples
### `GET api/now`
[./api/now.rb](https://github.com/Bhacaz/vercel-functions-ruby-test/blob/main/api/now.rb)
```shell
curl http://localhost:8000/api/now
```
### `POST api/multiply`
[./api/multiply.rb](https://github.com/Bhacaz/vercel-functions-ruby-test/blob/main/api/multiply.rb)
```shell
curl -X POST 'http://localhost:8000/api/multiply' -H 'Content-Type: application/json' -d '{ "x": 2, "y": 4 }'
```
## Auto restart
Use the [gem `rerun`](https://github.com/alexch/rerun) to restart the server on change.
```shell
rerun --dir api server.rb
```
## Thanks
Thanks for the inspiration https://github.com/gior/vercel-dev-ruby/