You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
492 B
JavaScript
14 lines
492 B
JavaScript
const http = require('http')
|
|
const port = 3000
|
|
|
|
const app = http.createServer((request, response) => {
|
|
if (request.url == '/login') {
|
|
response.writeHead(200, {'content-type': 'text/plain'})
|
|
response.end("Welcome to the login page")
|
|
} else {
|
|
response.writeHead(404, {'content-type': 'text/plain'})
|
|
response.end("I'm sorry, the page you are looking for cannot be found")
|
|
}
|
|
})
|
|
app.listen(port)
|
|
console.log(`Server now accesible at localhost:${port}.`) |