Skip to content

be-first-express-simple-server-JanaHeyn created by GitHub Classroom

Notifications You must be signed in to change notification settings

fbw-d09/be-first-express-simple-server-JanaHeyn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An almost simple server in Express.js

Status overview badge

This project will allow you to practice setting up a server that will handle simple requests in Express.js.

What you will be doing

You will be setting up a server with four endpoints using the Express.js framework.

The endpoints will only respond to GET requests, and send a string as a response.

Tasks

Task 1 - Getting ready

  1. Install the express.js npm package npm i express
  2. Create the file server.js

Task 2 - Setting up your server

Use the following code to setup your server

import express from "express";

const app = express();

const server = app.listen(3001, () => {
  console.log("The server is listening... 🐒");
});

Task 3 - GET '/hello'

Create an endpoint that will respond to the path /hello

  • It should send a response with a string. Use the following string;
Hello to you too!

Task 4 - GET '/time'

Create an endpoint that will respond to the path /time.

  • It should return a response with the current time and date

Research:

Date Object [en]

Date Object [de]

Task 5 - GET '/random'

Create an endpoint that will respond to the path /random.

  • It should send a response with the random number

Research:

Math.random() [en]

Math.random() [de]

Task 6 - GET '/fact'

Create an endpoint that will respond to the path /fact.

  • It should send a response with a string. Use the following string;
JavaScript was created in about 10 days!

Results

⌛ Give it a minute. As long as you see the orange dot processing on top, CodeBuddy is still processing. Refresh this page to see it's current status.

This is what CodeBuddy found when running your code. It is to show you what you have achieved and to give you hints on how to complete the exercise.

JS file

Status Check
Status server.js should exist

🔬 Results Details 🐞 Tips on Debugging 📢 Report Problem

About

be-first-express-simple-server-JanaHeyn created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published