[英]"Parsing error: Unexpected token => eslint"
我在 VSC 中的 index.js 文件中看到此錯誤,這似乎是由 app.post 請求引起的。
我已經嘗試了關於 eslint 和 emca 的不同解析選項,但仍然沒有得到任何結果。
感謝任何輸入。
解析錯誤:意外的令牌 => eslint<\/strong>
index.js
const functions = require("firebase-functions");
const express = require("express");
const cors = require("cors");
const stripe = require("stripe")("hidden");
// Setting Up the API
// - App Config
const app = express();
// - Middlewares
app.use(cors({ origin: true }));
app.use(express.json());
// - API routes
app.get("/", (request, response) => response.status(200).send("hello world"));
app.post("/payments/create", async (request, response) => {
const total = request.query.total;
console.log("Payment Request Recieved for this amount >>> ", total);
const paymentIntent = await stripe.paymentIntents.create({
amount: total, // subunits of the currency
currency: "usd",
});
// OK - Created
response.status(201).send({
clientSecret: paymentIntent.client_secret,
});
});
// - Listen command
exports.api = functions.https.onRequest(app);
好像您缺少parser: @babel/eslint-parser
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.