Skip to content

Introduce Authentication Pages for EMS Login and Registration #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
backend/node_modules/
fontend/node_modules/
fontend/package-lock.json/
45 changes: 45 additions & 0 deletions backend/appwriteCRUD.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Client, Databases, ID } from "appwrite";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('65b13a1a34e4ce543872');

const databases = new Databases(client);


// Create documents
const create = databases.createDocument(
'ems',
'user',
ID.unique(),
{
FullName: "Test shdh",
PhNum: 1234567890,
email: "[email protected]",
password: "dsjfkdshhfa",
ip: "192.182.111.23",
joiningDate: new Date().toISOString()
}
);

create.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});


// List documents
// let list = databases.listDocuments(
// '[ems]',
// '[user]',
// [
// Query.equal('title', 'Avatar')
// ]
// );

// list.then(function (response) {
// console.log(response);
// }, function (error) {
// console.log(error);
// });
33 changes: 33 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Client, Databases, ID } from "appwrite";
const express = require('express');
const cors = require('cors');
const app = express();
const PORT = 3000;

app.use(cors());



const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

const databases = new Databases(client);

const promise = databases.createDocument(
'[DATABASE_ID]',
'[COLLECTION_ID]',
ID.unique(),
{}
);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});


app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
})
Loading