Saturday, February 25, 2023

IsOdd (and IsEven) as a Service

tl;dr Introducing new web service to determine if a number is odd or not.

Try it:

Is 43 odd? - yes!

Is 2 odd? - no

Is 3874.32 odd? - no, not an integer

Is foobar odd? - no. not a number

Rationale

A while back I found out about the is-odd npm module that give node.js developers a handy function isOdd to determine if a number is odd or not. The module has something like 500,000 downloads every day! Clearly this module fills a huge need in the node.js development world. But some people have expressed concern about excessive dependencies in the node/npm ecosystem. I thought, why not make this a web service? I can solve a few problems all at once:

  • No new code dependency in your npm modules
  • Nothing to download or install
  • Can use with almost any programming language, not just Javascript under node.js
  • No license
  • Easy to test in a web browser

How to use

Just make an HTTP or HTTPS request to isodd.dev with any string or number: https://isodd.dev/43 or https://isodd.dev/848784. Then examine the HTTP result code and/or the message returned in the response body. isodd.dev is fully RESTful and idempotent, so your code can make as many asynchronous calls as it needs to.

The response gets communicated back with clear HTTP response code:

200 odd
409 even
405 not an integer
400 not a number

That’s it.

Technology

The back-end is Rust and Elixir using AWS lambda, and the Blockchain. I used vim on Ubuntu Linux, ChromeOS, git, and GitHub to develop isodd.dev. I plan to make the code available once I decide on the appropriate open-source license.

Is this free?

It is for now. I’m looking into how to monetize this service. For now enjoy the free and ad-free service.

Wait – there’s more!

During initial testing with early adopters I decided to make a companion service, iseven.dev. It works exactly like isodd.dev only for determining if a number is even. Of course you can just as easily do this with isodd.dev but why not use the best tool for the job?

Bugs and feature requests

I’ll have a support forum up soon. Please post bugs and feature requests in the comments until then.

Enjoy!



from Hacker News https://ift.tt/ljRP6F0

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.