27 lines
565 B
JavaScript
27 lines
565 B
JavaScript
const express = require('express')
|
|
|
|
require('dotenv').config()
|
|
|
|
const app = express()
|
|
const port = process.env.port || 5000
|
|
|
|
const cors = require('cors')
|
|
const path = require('path')
|
|
|
|
app.use(cors())
|
|
|
|
app.get('/air', (req, res) => {
|
|
console.log(`Searching for contacts with the term: ${req.query.name}`)
|
|
res.send({
|
|
success: true,
|
|
data: [],
|
|
})
|
|
})
|
|
|
|
app.use(express.static('public'))
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.resolve(__dirname, 'public', 'index.html'))
|
|
})
|
|
app.listen(port, () => {
|
|
console.log(`Server is up at port ${port}`)
|
|
})
|