chipchoc/server.js
Badri Sunderarajan 77be57565d Set up Express
2021-04-29 16:42:34 +05:30

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}`)
})