-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (25 loc) · 937 Bytes
/
Copy pathserver.js
File metadata and controls
30 lines (25 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const express = require('express');
const fs = require('fs');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 5173;
// Serve static assets from public
app.use(express.static(path.join(__dirname, 'public')));
// Serve the Farcaster manifest explicitly at /.well-known/farcaster.json
app.get('/.well-known/farcaster.json', (req, res) => {
const manifestPath = path.join(__dirname, '.well-known', 'farcaster.json');
fs.readFile(manifestPath, 'utf8', (err, data) => {
if (err) {
res.status(500).json({ error: 'Manifest not found or unreadable', details: err.message });
return;
}
res.type('application/json').send(data);
});
});
// Fallback to index.html for root
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.listen(PORT, () => {
console.log(`Farcaster Mini App server running at http://localhost:${PORT}/`);
});