如何在nodejs中获取异步存储的值



我在react native中使用异步存储保存了令牌。有什么方法可以在Node.js后端获得这个令牌值吗?

根据https://reactnative.dev/docs/asyncstorage你可以从仓库里拿到这个物品。您必须将其POST到后端。可能正在使用fetch

fetch('https://example.com/uploadtoken', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(TOKEN),
}).then(response => response.json()).then(data => {
console.log('Success:', data);
}).catch((error) => {
console.error('Error:', error);
});

最新更新