chipchoc/server.js

28 lines
565 B
JavaScript
Raw Normal View History

2021-04-29 06:07:41 -04:00
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}`)
})