Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //server.js
- app.get("/:url", (req, res) => {
- pool.connect()
- .then(client => {
- client.query(`
- select * from posts
- where url like '%${param}%'
- `)
- .then(data => {
- client.release();
- return res.status(200).json({ success: true, data: data.rows[0] });
- })
- });
- //app.js
- class App extends Component {
- componentWillMount() {
- if (this.props.path > 1) {
- Client.search(this.props.path, data => {
- console.log(data);
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement