nodejs express api
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
4
3
const express = require('express')
const app = express()
app.get('/', (req, res, next) => {
res.json({
message: 'This is my JSON api'
});
});
app.listen(your-port-here, () => {
console.log(`listening on http://localhost:${the-port-goes-here}`)
});
/*
WombleWoo7547 @ https://github.com/WombleWoo7547 https://replit.com/@WombleWoo7547
*/
Thank you!
3
0
4.2
5
app.render('email', function (err, html) {
// ...
})
app.render('email', { name: 'Tobi' }, function (err, html) {
// ...
})
Thank you!
5
0
Are there any code examples left?
New code examples in category Javascript