import { Wasteof2Auth } from 'wasteof-client'
const wasteof = new Wasteof2Auth('username','password')
await wasteof.post('hello world', null)
rpi@raspberrypi:~/Desktop $ node wasteof-funni.js
(node:4778) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/rpi/Desktop/wasteof-funni.js:1
import { Wasteof2Auth } from 'wasteof-client'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
rpi@raspberrypi:~/Desktop $
There should be a package.JSON file in the same folder as index.js. If there is, add "type": "module" to it. If there isn't, create one and put in { "type": "module" }. Or, you can change the file extension from .js to .mjs i think
I did the mjs thing and got a http error, I’ll have to show you Tomorrow though