1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

return something on root of commons server

This commit is contained in:
Matthias Kretschmann 2019-05-17 11:41:55 +02:00
parent 039f5da189
commit 1ea527f2d1
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 18 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import express from 'express'
import compression from 'compression' import compression from 'compression'
import morgan from 'morgan' import morgan from 'morgan'
import bodyParser from 'body-parser' import bodyParser from 'body-parser'
import pkg from '../../package.json'
// routes // routes
import UrlCheckRouter from './routes/UrlCheckRouter' import UrlCheckRouter from './routes/UrlCheckRouter'
@ -51,6 +52,15 @@ app.use(bodyParser.urlencoded({ extended: false }))
app.use(compression()) app.use(compression())
// routes // routes
app.get('/', (req, res) => {
res.send(
`<strong><code>
🏄 <br />
Ocean Protocol Commons Server v${pkg.version}<br />
<a href="https://github.com/oceanprotocol/commons" style="text-decoration:none;color:#f6388a">github.com/oceanprotocol/commons</a>
</code></strong>`
)
})
app.use('/api/v1/urlcheck', UrlCheckRouter) app.use('/api/v1/urlcheck', UrlCheckRouter)
/// catch 404 /// catch 404

View File

@ -5,6 +5,13 @@ afterAll(done => {
server.close(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', () => { describe('POST /api/v1/urlcheck', () => {
it('responds with json', async () => { it('responds with json', async () => {
const response = await request(server).post('/api/v1/urlcheck') const response = await request(server).post('/api/v1/urlcheck')

View File

@ -2,6 +2,7 @@
"compilerOptions": { "compilerOptions": {
"module": "commonjs", "module": "commonjs",
"esModuleInterop": true, "esModuleInterop": true,
"resolveJsonModule": true,
"target": "es6", "target": "es6",
"noImplicitAny": false, "noImplicitAny": false,
"moduleResolution": "node", "moduleResolution": "node",