dgf-prototype/backend/src/index.js

26 lines
579 B
JavaScript
Raw Normal View History

2024-03-19 22:22:36 -05:00
const express = require('express');
2024-04-20 12:37:59 -05:00
const read = require('./read');
const write = require('./write');
const importFromSS = require('./import-from-ss');
2024-03-19 22:22:36 -05:00
require('dotenv').config();
const app = express();
const port = process.env.PORT || 3000;
app.use(express.json());
app.post('/write', write);
app.get('/read/:hash', read);
app.post('/importFromSemanticScholar', importFromSS);
2024-03-19 22:22:36 -05:00
app.get('*', (req, res) => {
2024-04-04 12:55:59 -05:00
console.log(`404 req.path: ${req.path}`);
res.status(404).json({ errorCode: 404 });
2024-03-19 22:22:36 -05:00
});
app.listen(port, () => {
console.log(`Listening on port ${port}`);
});