Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //server.js
  2. app.get("/:url", (req, res) => {
  3.     pool.connect()
  4.         .then(client => {
  5.             client.query(`
  6.                 select * from posts
  7.                 where url like '%${param}%'
  8.             `)
  9.                 .then(data => {
  10.                     client.release();
  11.                     return res.status(200).json({ success: true, data: data.rows[0] });
  12.                 })
  13. });
  14.  
  15. //app.js
  16. class App extends Component {
  17.     componentWillMount() {
  18.         if (this.props.path > 1) {
  19.             Client.search(this.props.path, data => {
  20.                 console.log(data);
  21.             });
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement