diff --git a/server/src/server.ts b/server/src/server.ts index 598a499..5b0c975 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -3,6 +3,7 @@ import express from 'express' import compression from 'compression' import morgan from 'morgan' import bodyParser from 'body-parser' +import pkg from '../../package.json' // routes import UrlCheckRouter from './routes/UrlCheckRouter' @@ -51,6 +52,15 @@ app.use(bodyParser.urlencoded({ extended: false })) app.use(compression()) // routes +app.get('/', (req, res) => { + res.send( + ` + 🏄‍♀️
+ Ocean Protocol Commons Server v${pkg.version}
+ github.com/oceanprotocol/commons +
` + ) +}) app.use('/api/v1/urlcheck', UrlCheckRouter) /// catch 404 diff --git a/server/test/api.test.ts b/server/test/api.test.ts index a73159c..84c6872 100644 --- a/server/test/api.test.ts +++ b/server/test/api.test.ts @@ -5,6 +5,13 @@ afterAll(done => { server.close(done) }) +describe('GET /', () => { + it('responds with success', async () => { + const response = await request(server).get('/') + expect(response.statusCode).toBe(200) + }) +}) + describe('POST /api/v1/urlcheck', () => { it('responds with json', async () => { const response = await request(server).post('/api/v1/urlcheck') diff --git a/server/tsconfig.json b/server/tsconfig.json index e857d26..f0b8aae 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "module": "commonjs", "esModuleInterop": true, + "resolveJsonModule": true, "target": "es6", "noImplicitAny": false, "moduleResolution": "node",