Answers for "express modules"

14

node js express

basic server

const express =require('express');
const app = express();
const PORT = 5000;


app.get('/',(req,res)=>{
   res.json({message: 'Welcome to the backend'})
})


app.listen(PORT ,()=>console.log(`Connected to ${PORT}`)
Posted by: Guest on April-02-2020
6

require express server.js

const express = require('express')const app = express() app.get('/', function (req, res) {  res.send('Hello World')}) app.listen(3000)
Posted by: Guest on March-19-2020
1

express serve node module

app.use('/css', express.static(__dirname + '/css'));
app.use('/js', express.static(__dirname + '/node_modules/mod/dist'));
Posted by: Guest on July-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language