mirror of
https://github.com/engineer-man/piston.git
synced 2025-05-15 08:06:27 +02:00
commit
3266e803bd
6 changed files with 217 additions and 194 deletions
|
@ -163,7 +163,7 @@ router.use((req, res, next) => {
|
|||
return next();
|
||||
}
|
||||
|
||||
if (!req.headers['content-type'].startsWith('application/json')) {
|
||||
if (!req.headers['content-type']?.startsWith('application/json')) {
|
||||
return res.status(415).send({
|
||||
message: 'requests must be of type application/json',
|
||||
});
|
||||
|
|
|
@ -79,6 +79,12 @@ expressWs(app);
|
|||
const api_v2 = require('./api/v2');
|
||||
app.use('/api/v2', api_v2);
|
||||
|
||||
const { version } = require('../package.json');
|
||||
|
||||
app.get('/', (req, res, next) => {
|
||||
return res.status(200).send({ message: `Piston v${version}` });
|
||||
});
|
||||
|
||||
app.use((req, res, next) => {
|
||||
return res.status(404).send({ message: 'Not Found' });
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue