mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
remove next.js from API routes
This commit is contained in:
parent
6f9bf0176f
commit
313efa272a
@ -1,4 +1,4 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NowRequest, NowResponse } from '@now/node'
|
||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
import { IncomingHttpHeaders } from 'http'
|
import { IncomingHttpHeaders } from 'http'
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ async function checkUrl(url: string): Promise<FileResponse> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
export default async (req: NowRequest, res: NowResponse) => {
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
case 'POST':
|
case 'POST':
|
||||||
res.status(200).json(await checkUrl(req.body.url))
|
res.status(200).json(await checkUrl(req.body.url))
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NowRequest, NowResponse } from '@now/node'
|
||||||
import axios, { AxiosResponse } from 'axios'
|
import axios, { AxiosResponse } from 'axios'
|
||||||
import siteConfig from '../../../site.config'
|
import siteConfig from '../content/site.json'
|
||||||
|
|
||||||
async function redeploy(
|
async function redeploy(
|
||||||
req: NextApiRequest
|
req: NowRequest
|
||||||
): Promise<AxiosResponse | undefined | string> {
|
): Promise<AxiosResponse | undefined | string> {
|
||||||
// Cancel if we are not on live
|
// Cancel if we are not on live
|
||||||
if (req.headers.host !== siteConfig.url) return ''
|
if (req.headers.host !== siteConfig.site.siteUrl) return ''
|
||||||
console.log('not canceled', req)
|
console.log('not canceled', req)
|
||||||
try {
|
try {
|
||||||
// Trigger new `master` deployment with Deploy Hook
|
// Trigger new `master` deployment with Deploy Hook
|
||||||
@ -19,7 +19,7 @@ async function redeploy(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
export default async (req: NowRequest, res: NowResponse) => {
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
case 'POST':
|
case 'POST':
|
||||||
res.status(200).json(await redeploy(req))
|
res.status(200).json(await redeploy(req))
|
||||||
|
60
package-lock.json
generated
60
package-lock.json
generated
@ -6488,6 +6488,23 @@
|
|||||||
"fastq": "^1.6.0"
|
"fastq": "^1.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@now/node": {
|
||||||
|
"version": "1.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@now/node/-/node-1.7.1.tgz",
|
||||||
|
"integrity": "sha512-+srVKopsVTPDR3u9eOjJryZroLTrPp8XEOuIDGBdfFcJuS7qpAomctSbfyA7WNyjC0ExtUxELqBg5sAedG5+2g==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"ts-node": "8.9.1",
|
||||||
|
"typescript": "3.9.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"typescript": {
|
||||||
|
"version": "3.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz",
|
||||||
|
"integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@oceanprotocol/art": {
|
"@oceanprotocol/art": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/art/-/art-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/art/-/art-2.2.0.tgz",
|
||||||
@ -9300,6 +9317,11 @@
|
|||||||
"readable-stream": "^2.0.6"
|
"readable-stream": "^2.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||||
|
},
|
||||||
"argparse": {
|
"argparse": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
@ -15480,6 +15502,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
|
||||||
|
},
|
||||||
"diff-sequences": {
|
"diff-sequences": {
|
||||||
"version": "24.9.0",
|
"version": "24.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-24.9.0.tgz",
|
||||||
@ -29469,6 +29496,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||||
|
},
|
||||||
"makeerror": {
|
"makeerror": {
|
||||||
"version": "1.0.11",
|
"version": "1.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz",
|
||||||
@ -37184,6 +37216,29 @@
|
|||||||
"tslib": "^1.9.3"
|
"tslib": "^1.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ts-node": {
|
||||||
|
"version": "8.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.9.1.tgz",
|
||||||
|
"integrity": "sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==",
|
||||||
|
"requires": {
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"source-map-support": "^0.5.17",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"source-map-support": {
|
||||||
|
"version": "0.5.19",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz",
|
||||||
|
"integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==",
|
||||||
|
"requires": {
|
||||||
|
"buffer-from": "^1.0.0",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"ts-pnp": {
|
"ts-pnp": {
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.6.tgz",
|
||||||
@ -39799,6 +39854,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
||||||
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
|
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
|
||||||
},
|
},
|
||||||
|
"yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
|
||||||
|
},
|
||||||
"yoga-layout-prebuilt": {
|
"yoga-layout-prebuilt": {
|
||||||
"version": "1.9.6",
|
"version": "1.9.6",
|
||||||
"resolved": "https://registry.npmjs.org/yoga-layout-prebuilt/-/yoga-layout-prebuilt-1.9.6.tgz",
|
"resolved": "https://registry.npmjs.org/yoga-layout-prebuilt/-/yoga-layout-prebuilt-1.9.6.tgz",
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@loadable/component": "^5.13.0",
|
"@loadable/component": "^5.13.0",
|
||||||
|
"@now/node": "^1.7.1",
|
||||||
"@oceanprotocol/art": "^2.2.0",
|
"@oceanprotocol/art": "^2.2.0",
|
||||||
"@oceanprotocol/react": "0.0.11",
|
"@oceanprotocol/react": "0.0.11",
|
||||||
"@oceanprotocol/squid": "^2.2.0",
|
"@oceanprotocol/squid": "^2.2.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user