Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
SamplerJS demo
node v12.22.12
version:
0.3.0
endpoint
share
tweet
Post a JSON to get randomized data
const express = require("@runkit/runkit/express-endpoint/1.0.0"); const samplerjs = require("samplerjs"); const bodyParser = require('body-parser'); const app = express(exports); const parser = samplerjs.Parser.chanceParser; app.use(bodyParser.json()); app.get("/", (req, res) => res.send(`Post a JSON to ${process.env.RUNKIT_ENDPOINT_URL}`)); app.post("/", (req, res) => res.send(parser.parse(req.body)));
const result = parser.parse({ user: { firstName: "first", lastName: "last", tel: "phone", gender: "gender" }, description: "paragraph" });
Created from: https://npm.runkit.com/samplerjs
Loading…
no comments
sign in
to comment