Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
390 B

  1. const routes = require('express').Router();
  2. const sql = require('../../utils/sql');
  3. routes.get('/posts', (request, result) =>
  4. {
  5. sql.getAllPosts().then((data)=>
  6. {
  7. result.json(data).end();result
  8. }).catch((err)=>
  9. {
  10. result.status(500).json([]).end();
  11. });
  12. });
  13. routes.get('*', (request, result) =>
  14. {
  15. result.json([]).end();
  16. });
  17. module.exports = routes;