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.

66 lines
1.5 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//Add code here
const http = require('http');
const port =4000;
const app = http.createServer(function(request, response){
if(request.url == "/" && request.method == 'GET'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Welcome to Booking Systems')};
if(request.url == "/profile" && request.method == 'GET'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Welcome to your profile')};
if (request.url == '/courses' && request.method == 'GET'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Heres our courses available')};
if (request.url == '/addCourse' && request.method == 'POST'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Add a course to our resources')};
if (request.url == '/updateCourse' && request.method == 'PUT'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Update a course to our resources')};
if (request.url == '/archieveCourse' && request.method == 'DELETE'){
response.writeHead(200,{'Content-Type': 'text/plain'});
response.end('Archive courses to our resources')};
});
// if (request.url == '/updateCourses' && request.method == 'PUT'){
// response.writeHead(200,{'Content-Type': 'text/plain'});
// response.end('Update a course to our resources')};
//Do not modify
//Make sure to save the server in variable called app
if(require.main === module){
app.listen(4000, () => console.log(`Server running at port 4000`));
}
module.exports = app;