Compare commits
2 Commits
7441f2633d
...
17c4fdb51e
Author | SHA1 | Date |
---|---|---|
Thomas Hobson | 17c4fdb51e | |
Luka Barbić | e86c19b007 |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "piston-api",
|
"name": "piston-api",
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"description": "API for piston - a high performance code execution engine",
|
"description": "API for piston - a high performance code execution engine",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -163,7 +163,7 @@ router.use((req, res, next) => {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!req.headers['content-type'].startsWith('application/json')) {
|
if (!req.headers['content-type']?.startsWith('application/json')) {
|
||||||
return res.status(415).send({
|
return res.status(415).send({
|
||||||
message: 'requests must be of type application/json',
|
message: 'requests must be of type application/json',
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,6 +79,12 @@ expressWs(app);
|
||||||
const api_v2 = require('./api/v2');
|
const api_v2 = require('./api/v2');
|
||||||
app.use('/api/v2', 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) => {
|
app.use((req, res, next) => {
|
||||||
return res.status(404).send({ message: 'Not Found' });
|
return res.status(404).send({ message: 'Not Found' });
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue