write an example usage of express (js)
- User
write an example usage of express (js)
Assistant
Here's a basic example of an Express app:
jsconst express = require('express') const app = express() // Handle GET requests to the / route app.get('/', (req, res) => { res.send('Hello World!') }) // Handle GET requests to the /about route app.get('/about', (req, res) => { res.send('About page') }) // Handle 404 requests app.use((req, res, next) => { res.status(404).send('Sorry, that route does not exist!') }) // Listen on port 3000 app.listen(3000, () => { console.log('Server started on port 3000') })
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.