Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Devindi Jayathilaka devindianushika

🎯
Focusing
  • University Of Moratuwa Faculty Of Information Technology
  • Sri lanka
View GitHub Profile
@devindianushika
devindianushika / app.js
Last active May 18, 2020
connect with Mongodb
View app.js
const express = require ('express');
const app = express();
const port = 3000;
const mongoose = require('mongoose');
const config = require ('./config/database');
const routeuser = require('./routes/routeuser');
const bodyParser = require('body-parser');
@devindianushika
devindianushika / routeuser.js
Last active May 21, 2020
Implement Main CRUD operations
View routeuser.js
const express = require('express');
const router = express.Router();
const User = require('../models/user');
router.post("/register", (req, res) => {
const newUser = new User({
name: req.body.name,
email: req.body.email,
@devindianushika
devindianushika / user.js
Last active May 21, 2020
Mongoose schema file
View user.js
const mongoose = require('mongoose');
const schema = mongoose.Schema
const userSchema = new schema({
name: { type: String, required: true },
email: { type: String, required: true },
});
@devindianushika
devindianushika / app.js
Created May 9, 2020
create a server using Node js
View app.js
const express = require ('express');
const app = express();
const port = 3000;
app.get("/",function(req,res){
res.end("hello world");
})
app.listen(port,function(){
console.log("server is running port " + port);
@devindianushika
devindianushika / instruct1.txt
Last active Mar 22, 2020
create REACT app: If you use npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:
View instruct1.txt
npm install -g create-react-app
View NewCircle.java
package com.poly.overloading;
public class NewCircle {
public void draw(){
System.out.println("circle with default color Black and diameter 1 cm.");
}
public void draw(int diameter){
System.out.println("circle with default color Black and diameter"+diameter+"cm.");
}
public void draw(int diameter, String color){
View Square.java
package com.poly.overriding;
public class Square implements Shape {
@Override
public void draw() {
System.out.println("Drawing Square");
}
View Circle.java
package com.poly.overriding;
public class Circle implements Shape{
@Override
public void draw(){
System.out.println("Drwaing circle");
}
View Shape.java
package com.poly.overriding;
public interface Shape {
public void draw();
}
View IsaRelationship.java
class Parent{
public void m1() {
System.out.println("parent");
}
}
class Child extends Parent{
public void m2(){
System.out.println("child");
}