A Standalone Server in Dart and frontend in HTML & CSS. This is a sample GSoC 2021 Project under dart organization.
bin/
, library code in lib/
, client side code in public/
, and example unit test in test/
.Following features have been implemented:
database/users.json
Screen Name | Screenshots |
---|---|
Landing Page | ![]() |
Login Page | ![]() |
Register Page | ![]() |
Dashboard Page | ![]() |
standalone_server
┃
┣ bin (contains main server.dart file )
┃
┣ database (contains a user.json file storing users list as local JSON storage)
┃
┣ lib
┃ ┣ interops (contains dart codes for Javascript interoperability)
┃ ┣ src
┃ ┃ ┣ apis
┃ ┃ ┃ ┗ validators (validator for validating input fields like name, email & password)
┃ ┃ ┣ configs
┃ ┃ ┃ ┣ routes.dart (all the routes mounted)
┃ ┃ ┃ ┗ utils.dart (functions commonly used are mentioned here)
┃ ┃ ┗ models (contains user model)
┃ ┗ server.dart (exports the package to bin/server.dart)
┃
┣ public (contains client side code like css, html & assets)
┃ ┗ assets
┃
┣ resources (contains screenshots & demo video)
┃
┗test (contains test.dart file)
Routes | REST request | Description | Requirements |
---|---|---|---|
/ |
GET | serves landing.html page | |
/auth/register |
GET | serves register.html page | |
/auth/register |
POST | registers the user and returns a JWT token | needs name, email & password as body |
/auth/login |
GET | serves login.html page | |
/auth/login |
POST | logs in the user and returns a JWT token | needs email & password as body |
/assets/<file.*> |
GET | serves static files under public/assets/ |
|
/auth/logout |
POST | logs out the user | needs Bearer token as authorization header |
/user/ |
GET | returns logged in user info in JSON | needs Bearer token as authorization header |
/user/ |
PATCH | edits the name of logged in user | needs Bearer token as authorization header & new name as body |
/user/ |
DELETE | deletes logged in user account | needs Bearer token as authorization header |
/dashboard |
GET | serves dashboard.html page | |
/file/<userid>/<file.*> |
GET | serves files from disk to authenticated users only (Here, sample.pdf) |
Perform the following operations to set up the project.
git clone git@github.com:imKashyap/Standalone-Server.git
pub get
nodemon
Nodemon is an NPM package used to watch for the changes in source code and restart the shelf server automatically. You can install it by doing
npm i -g nodemon
. But make sure node is installed in your machine.
Visit http://localhost:4040 and make sure you see the following screen: