Nevin
Nevin

Reputation: 161

How to Place the token on my site in google site verification process

Hi i'm unable to verify site in site verification process.

Step 1: verification token by calling getToken method

This is the response i'm getting from step1:

{ "token": "google12cfc68677988bb4.html", "method": "FILE" }

Step 2: Place the token on your site using whatever method you choose.

My question is how to place token (google12cfc68677988bb4.html) on site.I stuck in step 2. can any one help?

Upvotes: 0

Views: 552

Answers (1)

EMX
EMX

Reputation: 6211

Using Express : Serve Static

You can set up a public dir, and serve the static .html file from there:

const express = require('express')
const app = express()

app.use(express.static('public'));

app.get('/', function (req, res) {
 res.send('Hello World!')
})

app.listen(7777, function () {
  console.log('Example app listening on port 7777!')
})

So with : app.use(express.static('public')); you are telling express to use the folder called public for serving static files.

Create the public directory, include the google verification .html inside and try to access it (localhost:7777/google12cfc68677988bb4.html)


Using Express : GET Route

app.get('/google12cfc68677988bb4.html', function (req, res) {
 res.sendFile(__dirname+"/google12cfc68677988bb4.html");
})

(I would go for the serve static instead)

Upvotes: 1

Related Questions