Basic Node and Express - Start a Working Express Server - rJMhx_GUa07-55SRKWKgc

maybe i should start over and us replit

ok im going to try it in replit

are there other sites to try? I cant get those to work.

the erros im getting:
npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

 npm start

start
node server.js

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module ‘express’
Require stack:

  • /home/runner/boilerplate-npm-3/server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object. (/home/runner/boilerplate-npm-3/server.js:9:15)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘/home/runner/boilerplate-npm-3/server.js’ ]
    }
    exit status 1
     ^C

That’s from replit and I only add the author’s name with my name.

You can also give CodeSandbox a try.

I followed your video and found out I needed to type enable-npm not enable npm. it reloaded fine but in the result, it reads not found. I guess I will have to learn how to Zoom in the morning. :man_shrugging:

yep i did that just like your video but I know I did something different

glitch is stating that on its own I guess it saves it so how do I remove it from my dashboard.

Are you using Sandbox if so how did you get the boilerplate in the sandbox. is there a link like in past courses?

I’m going back over the posed to try that and I’m using edge now too. I archived the file so everything is new plus I going to try sandbox if I can get the boilerplate in the sandbox.

Ok I got Sandbox working ok

var express = require("express");
var app = express();
console.log("Hello World");
app.get("/", (request, reponse) => {
  reponse.send("Hello Express");
});

Console.log works but not the Hello Express. I don’t see the problem and I don’t know how to use the terminal in Sandbox. to put in the enable-npm. but i think it is my code, not the terminal do you see a mistake.
https://ryhxke.sse.codesandbox.io/

You seem to have remove module.exports from the bottom in myApp.js

module.exports = app;

Also, please link to the editor instead.

the module is there I don’t think it’s in working so how do i fix that
My Sand box

let express = require("express");
let app = express();

app.get("/", (req, res) => {
  res.send("Hello Express");
});
// function(req, res) {
//   res.send('Response String');
// }
module.exports = app;

Your code is passing for me. What link are you submitting, it has to be the live app link.

https://jjufsf.sse.codesandbox.io/

I haven’t submitted because there is nothing in my preview window

it passed thanks for all your help

Do you know how to get the DOTEVN in to sandbox? :sweat:

  1. Add a .env file with whatever values you need.

  2. Install the dotenv package.

  3. Use it in the main file (server/index/whatever) by adding require('dotenv').config() to the top of the file.

I got replit working now so how do get one on replit. Sorry if I’m causing problems but it is just easier to use replit for me. :grin:

When using the secrets tab the variables should just be available on process.env