Created
October 30, 2018 14:53
-
-
Save converge/41c89bc89b07b425ad627059eec4398f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# axios | |
# | |
import axios from 'axios' | |
const api = axios.create({ | |
baseURL: 'http://localhost:3000' | |
}) | |
export default api; | |
# | |
# express | |
# | |
app.get("/get_username_by_username", function(req, res) { | |
try { | |
const stmt = db.prepare( | |
"SELECT id, username, password FROM ig_account WHERE username = ?" | |
); | |
const row = stmt.get(req.query.username); | |
return res.status(200).json({ | |
data: row | |
}); | |
} catch (err) { | |
return res.status(500).send("Something went wrong"); | |
} | |
}); | |
# | |
# chamada | |
# | |
const response = await api.get("/get_username_by_username", { | |
params: { | |
username: this.props.active_ig_account | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment