Skip to content

Commit

Permalink
format using prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
petertimwalker committed May 27, 2024
1 parent 606a512 commit 2f338ff
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}
38 changes: 19 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.configPath": "./.prettierrc",
"editor.formatOnSave": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
}
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.configPath": "./.prettierrc",
"editor.formatOnSave": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ This is important because Single Page Applications expose any secrets they are b

I use certbot to create the https certifications

```sudo yum install -y certbot```
`sudo yum install -y certbot`

```sudo certbot certonly --standalone -d api.peterwalker.xyz```
`sudo certbot certonly --standalone -d api.peterwalker.xyz`

I run this process in the background of my EC2 server using
```sudo pm2 start server.js```
`sudo pm2 start server.js`
11 changes: 6 additions & 5 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ const dotenv = require('dotenv');
dotenv.config();

// Use CORS middleware to allow requests from all origins
app.use(cors({
origin: 'https://peterwalker.xyz',
}));
app.use(
cors({
origin: 'https://peterwalker.xyz',
}),
);

// Store your API key securely in an environment variable
const API_KEY = process.env.API_KEY || 'API_KEY not defined';
Expand All @@ -35,11 +37,10 @@ app.get('/api/key', (req, res) => {
const options = {
key: fs.readFileSync('/etc/letsencrypt/live/api.peterwalker.xyz/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/api.peterwalker.xyz/cert.pem'),
ca: fs.readFileSync('/etc/letsencrypt/live/api.peterwalker.xyz/chain.pem')
ca: fs.readFileSync('/etc/letsencrypt/live/api.peterwalker.xyz/chain.pem'),
};

// Start the HTTPS server
https.createServer(options, app).listen(PORT, () => {
console.log(`HTTPS Server is running on port ${PORT}`);
});

0 comments on commit 2f338ff

Please sign in to comment.