1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00
commons/server
2020-05-18 18:07:30 +00:00
..
src fix Travis 2020-02-01 14:25:35 +01:00
test test fixes 2019-10-14 10:57:06 +02:00
.env.example use final IPFS gateway url in server 2019-10-14 10:57:37 +02:00
Dockerfile task cleanup 2019-04-12 16:26:13 +02:00
package-lock.json Bump @types/request from 2.48.4 to 2.48.5 in /server 2020-05-18 18:07:30 +00:00
package.json Bump @types/request from 2.48.4 to 2.48.5 in /server 2020-05-18 18:07:30 +00:00
README.md support adding files from IPFS url 2019-10-14 10:56:32 +02:00
tsconfig.json fix Travis 2020-02-01 14:25:35 +01:00

banner

Commons: Server

This folder contains server component written in TypeScript using Express. The server provides various microservices.

Get Started

To spin up the server in a watch mode for local development, execute:

npm install
npm start

API Documentation

Url Checker

Url Checker returns size and additional information about requested file. This service is used as a solution to frontend CORS restrictions.

Endpoint: POST /api/v1/urlcheck

Request Parameters

{
  "url": "https://oceanprotocol.com/tech-whitepaper.pdf"
}
{
  "url": "ipfs://QmQfpdcMWnLTXKKW9GPV7NgtEugghgD6HgzSF6gSrp2mL9"
}

Response: Success

{
  "status": "success",
  "result": {
    "found": true,
    "contentLength": "2989228",
    "contentType": "application/pdf"
  }
}

Response: Error

{
  "status": "error",
  "message": null
}

Report

Report endpoints sends an email via SendGrid. Requires SENDGRID_API_KEY set as environment variables.

Endpoint: POST /api/v1/report

Request Parameters

{
  "msg": {
    "to": "test@example.com",
    "from": "test@example.com",
    "subject": "My Subject",
    "text": "Text",
    "html": "<strong>HTML</strong>"
  }
}

Response: Success

{
  "status": "success"
}

Response: Error

{
  "status": "error",
  "message": "Error message"
}

🎁 Contributing

See the page titled "Ways to Contribute" in the Ocean Protocol documentation.

🏛 License

Copyright 2019 Ocean Protocol Foundation Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.