Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. const express = require('express')
  2. var path = require('path');
  3.  
  4. const app = express()
  5. const port = 8080;
  6.  
  7.  
  8.  
  9. app.listen(port, () => console.log(`Example app listening on port ${port}!`))
  10.  
  11. // get no file
  12. // app.get('/', (req, res) => res.send('Hello World Bitch!'))
  13. app.get('/', function (req, res) {
  14. res.sendFile(path.join(__dirname + '/index.html'));
  15. });
  16.  
  17. app.get('/test-get', function (req, res) {
  18. res.send('Hello World TestGet!')
  19. })
  20.  
  21. app.post('/test-post', function (req, res) {
  22. res.send('Hello World TestPost!')
  23. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement