Skip to content

Instantly share code, notes, and snippets.

View conor-deegan's full-sized avatar
✌️

Conor Deegan conor-deegan

✌️
View GitHub Profile
@conor-deegan
conor-deegan / pgp.txt
Last active June 14, 2025 13:14
pgp.txt
Proving ownership of:
- https://www.conor.computer via https://www.conor.computer/pgp.txt & proof at https://www.conor.computer/pgp.txt.asc
- https://www.conordeegan.dev via https://www.conordeegan.dev/pgp.txt & proof at https://www.conordeegan.dev/pgp.txt.asc
- https://x.com/ConorDeegan4
- https://github.com/conor-deegan via https://gist.github.com/conor-deegan/cf8a63f01ed6a01460215234f06f3f3e
PGP key: 1157 FABB 4B58 3A92 69D1 C332 9EC5 30B5 788C 0870
Full Public Key:
app.get('/', (req, res, next) => {
fs.readFile('/file-does-not-exist', (err, data) => {
if (err) {
// This will pass this error directly to our error handler
next(err)
} else {
res.status(200).json(data);
}
})
})
@conor-deegan
conor-deegan / decentralised.js
Last active September 14, 2020 15:17
Decentralised Error Handling in Express
app.get('/', (req, res) => {
fs.readFile('/file-does-not-exist', (err, data) => {
if (err) {
// Return an error directly from the route
res.status(404).json(err);
} else {
res.status(200).json(data);
}
})
})
import React, { Component } from 'react';
import './App.css';
import axios from 'axios'
class App extends Component {
state = {
response: {}
};
componentDidMount() {
const express = require('express');
const router = express.Router();
const controllers = require('./../controllers/controllers');
router.get('/say-something', controllers.saySomething);
module.exports = router;
const saySomething = (req, res, next) => {
res.status(200).json({
body: 'Hello from the server!'
});
};
module.exports.saySomething = saySomething;
// Import dependencies
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const path = require('path');
// Create a new express application named 'app'
const app = express();
// Set our backend port to be either an environment variable or port 5000