basic node js
in basic node js we just create routes and send the response
import express from 'express';
import dotenv from 'dotenv';
import newAssign from './newServer.js';
import new1Assign from './new1assign.js';
const app = express();
dotenv.config({
path:'./.env'
})
const port = process.env.PORT || 5000;
app.get('/', (req,res)=> {
res.send('welcome to men and woman dummy data ')
})
app.get('/men', (req,res) => {
res.send(' accept 10 product data men ')
})
app.get('/woman', (req,res) => {
res.send('accept 10 products data of woman')
})
app.get('other', (req,res) => {
res.send('page not found ')
})
app.listen(port, () => {
console.log(`app is listening on port http://localhost:${port}`)
})
this is the above code and we written the routering and just complete the normal syntax
Github uploading content
we just upload on the github this code will assignment for the pw skills
some git commands for the uploading the files
// git commands for new repository
create a new repository on the command line
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:Git_userName/Repository_name
git push -u origin main
push an existing repository from the command line
git remote add origin git@github.com:Git_userName/Repository_name
git branch -M main
git push -u origin main
for already connected repository command line
git add .
git branch -M main
git commit -m "the comment for the push code "
git push -u origin main
above are the git command that use for uploading the files after connecting the vs code with ssh key this key connect to the vs code and make it easy to the uploading the files