Skip to content

Komanc/instantapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instantapi.js

Usage

Start server with

npm start

Request

$.get("http://localhost:3210/" + encodeURIComponent(JSON.stringify(
    {
      users: {
        firstName: "@str(10, 20)",
        lastName: "@str(10, 20)",
        age: "@num(0, 100)",
        "@repeat": 5
      }
    }
  )))

and response

{
  "users": [
    {
      "firstName": "XsrKtIRHJd",
      "lastName": "ScKmfVDGTxIeooZHF",
      "age": 28
    },
    {
      "firstName": "RcpwGUxKtn",
      "lastName": "SbcEfIvvrpMBeULMU",
      "age": 89
    },
    {
      "firstName": "zoabOugVGAg",
      "lastName": "HRPbiNEgEt",
      "age": 90
    },
    {
      "firstName": "CCpBLPsZhSqOKtVe",
      "lastName": "hNWfZABkHpo",
      "age": 37
    },
    {
      "firstName": "TseRpbCjhaAgmxBgsP",
      "lastName": "ZuwqLKNPFyIYSqNl",
      "age": 13
    }
  ]
}

@num(min, max)

Returns integer between min (inclusive) and max

@str(min, max)

Returns string between min (inclusive) and max

@repeat

Return array with repeated object

Run server

npm start

Run tests

npm test

About

Instant API for development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 89.9%
  • HTML 10.1%