-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (25 loc) · 676 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (25 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var express=require("express");
var app=express();
var bodyParser=require("body-parser");
//const request = require('request');
const assert = require('assert');
//SETUP
app.use(bodyParser.urlencoded({extended:true}));
app.set("view engine","ejs");
app.use(express.static(__dirname + "/public"));
//ROUTES
app.get("/",function(req,res){
res.render("home");
});
app.post("/encrypt", function(req,res){
const data=req.body.data;
lst=[];
for (var i = 0; i < data.length; i++) {
lst.push(data.charCodeAt(i)+3);
}
res.render("show", {lst:lst});
});
//CREATE THE WEB SERVER AT SPECIFIED PORT
app.listen(3000,function(){
console.log("Server started");
});