Skip to content
Sign upLog in
← Back to Community
How to require something in js
Profile icon
TylerBernardo

I'm trying to set up jsonstore and learn how to use it. And with the code in the repl.it tutorial post, it get an error saying that "require is not definded"
Code im using:

let axios = require("axios"); let url = "https://www.jsonstore.io/8f5937788bd075f01486098d0716d08abba1069a6d79dac7b34a9df19119a199" axios.get(url) .then(response => { let myData = response.data; console.log(myData); }) .catch(e => console.log(e));
Voters
Profile icon
alexmattyou
Profile icon
khang9a5lqc11ng
Profile icon
TylerBernardo
Comments
hotnewtop
Profile icon
Highwayman

That’s because you’re using an html repl not a node.js repl.

Profile icon
TylerBernardo

@Highwayman
so is there anyway to use jsonstore with javascript?

Profile icon
eco27

@TylerBernardo
you dont need to require axios, its just an http request framework. you can make http requests in normal javascript and use jsonstore

Profile icon
Highwayman

@TylerBernardo
yes, but idk how because I’m just used to the jsonstore module in node. I’m pretty sure if you just make whatever get or post or put requests to the link you have, then it should work. I dont know though.