I trying to create a app where end user will request for services after that notification will be sent to the service provider, once the service provider accepts the user request user will be notified via notification that his request is accepted by one of the service provider.
Below is the stack which I am using.
Node.js, Express.js, Socket.io, React.js
below is the code for server.js
const express = require('express')
const app = express()
const server = require('http').createServer(app);
const io = require('socket.io')(server)
const cors = require('cors')
var routes = require('./routes/routes')
const port = process.env.PORT || 8080
app.use(express.json({ limit: "100mb" }))
app.use(express.urlencoded({ extended: false }))
app.use(cors())
app.use(routes)
app.use(express.static('uploads'))
app.io = io
server.listen(port,()=>{
console.log('API server started on: ',port)
})
There is a booking api which is accepting the booking from user.
I want to know how I have to write code for sending notification to service provider.
This is how I am trying to generate notification when api request comes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…