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
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: |
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
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); | |
} | |
}) | |
}) |
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
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); | |
} | |
}) | |
}) |
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
import React, { Component } from 'react'; | |
import './App.css'; | |
import axios from 'axios' | |
class App extends Component { | |
state = { | |
response: {} | |
}; | |
componentDidMount() { |
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
const express = require('express'); | |
const router = express.Router(); | |
const controllers = require('./../controllers/controllers'); | |
router.get('/say-something', controllers.saySomething); | |
module.exports = router; |
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
const saySomething = (req, res, next) => { | |
res.status(200).json({ | |
body: 'Hello from the server!' | |
}); | |
}; | |
module.exports.saySomething = saySomething; |
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
// 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 |