Skip to content

Instantly share code, notes, and snippets.

@tzafrirben
Last active September 2, 2020 08:16
Show Gist options
  • Save tzafrirben/4b30e758506c578fb5974e82a7fdebdf to your computer and use it in GitHub Desktop.
Save tzafrirben/4b30e758506c578fb5974e82a7fdebdf to your computer and use it in GitHub Desktop.
const newUser = {
userName: "[email protected]",
firstName: "John",
lastName: "Doe",
...
};
const request = require('request');
const options = {
method: 'POST',
url: 'http://localhost:3000/v1/users',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(newUser)
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment